25
February
2022
Heic in JPEG, JPEG to Heic: Convert images of Heif format
14:10

Heic in JPEG, JPEG to Heic: Convert images of Heif format

25 February 2022 14:10

An e -mail came a letter with investments with images with the expansion .heic. How to view and how to convert HEIC files?

Heif is a format for compressing images with very strong compression (High Efficiency Image Format). If the file takes 1.5 MB in the JPEG, then in Heic - 70 KB with the same resolution, without, "squares", "steps" and noise. The disadvantage is very high requirements for computing resources during compression. Heic is used by Apple.

Image output from the HeIF file file on the screen

(View program for heic files)

In Linux, it is convenient to view heic files using the EOG (Eye of Gnome) program.

sudo apt-get install eog

In the Graphic program menu, it is called either “image viewer” (purple icon), or “View images” .

Open the .heic file by pressing the right mouse button - graphics - "View images".

Transformation from Heis format to JPEG

You need to install the Libeif-Examples package:

sudo apt-get install libheif-examples

From the command line you can transfer Heic to JPEG by one file using the Heif-Convert utility:

heif-convert input.heic output.jpg

Or you can use the FOR cycle to convert all the files from the Heic to JPG.

for file in .\*.heic; do heif-convert -q 60 "$file"   "${file%.heic}.jpg"; done;

It is convenient to use the next shell script:

#!/bin/bash
for file in *.heic; do heif-convert -q 60 "$file" "${file%.heic}.jpg"; done;

where 60 is the quality of JPEG.

JPEG transformation to Heic

The HEIF format can be useful for transmitting images through communication channels with limited throughput. Although I did not use it, I know that there are programs for a computer for transmitting files via radio, for example, Flarq from a Fldigi package.

Heic transformations to JPG is made by command

heif-enc -q 30 -o output.heic input.jpg -v

where 30 is the quality parameter of the heif algorithm.

A detailed description of the options can be displayed using the Man Heif-Eenc command.

To convert several JPG files to .heic, you need to use the For:

for file in *.jpg; do heif-enc -q 30 -o "${file%.jpg}.heic"   "$file"; done;

or arrange a team in Shell script

#!/bin/bash
for file in *.jpg; do heif-enc -q 30 -o "${file%.jpg}.heic" "$file"; done;


examples:

Source jpeg file - compression degree Q = 60, size 50 kbytes (fragment)
jpg

File in HeIF degree of compression = 30, size 12 KB (fragment)
heic-12kb

File in Heif degree of compression = 20, size 6 kbytes (fragment)
heic-6kb

Initial heic files with varying degrees of compression:
Heic.zip

Coding several images in one Heif container

The .heic file is a container in which several images can be stored.

For coding a series of images in one file, a command is used

heif-enc -q 30 -o result.heic in1.png in2.png in3.png

Unfortunately, on viewing, the EOG program shows only the first file, at number 1.

GIMP graphic editor opens all files in the Heic container. When opening, you can choose any picture from the container:
выбор

An example of a file with a container in which there are 2 images:
Container.res.heic.zip



Related publications