Playing with HEIC images in lossless mode

One of the most interesting features of the new HEIF/HEIC image format — and a true expected innovation — is lossless compression.

Before the HEIC era, to chose between lossy or lossless required the user to completely switch between image file formats:

  • You had to chose lossy (JPEG) if you needed small file size, loosing other features such as alpha channel (transparency). Not to mention to loose forever the original information about your subject. And loosing even more every time you edit your photos.
  • You had to chose lossless (PNG, TIFF) if you needed alpha channel and pixel perfectness for computer-generated samples. Having to deal with potentially bigger file sizes and formats not popular with EXIF, XMP and IPTC tags and metadata.

The new HEIF format with HEVC (H.265) compression (HEIC) unifies all of that. One single industry-standard image format can handle:

  • advanced lossy and lossless with high compression rates for the smallest possible file sizes
  • transparency and alpha channel
  • animations (remember GIF ?)
  • photo metadata with EXIF, XMP, IPTC and MPEG-4 style info

I used macOS 10.13.6 plain Preview app to convert some pictures and photos to lossless HEIF/HEVC. The conversion is of very high quality, preserving all original files metadata. These are the impressive results:

Original file size in bytes Lossless HEIC file size in bytes Compression rate Picture dimensions Source image type
19,572,288 13,898,345 71.01% 6016×4016 Nikon DSLR camera raw photo processed by Adobe tools and saved as DNG
22,250,018 7,367,322 33.11% 4352×3264 Unprocessed Canon G1X raw photo (CR2)
3,208,062 7,251,778 226.05% 4032×3024 iPhone X regular unprocessed JPEG photo
635,773 424,807 66.82% 6452×3326 Large computer-generated PNG file with gradients and alpha channel
5,031 103,514 2057.52% 600×600 Small computer-generated PNG file with gradients and alpha channel
21,141,605 8,537,321 40.38% 5891×2271 PNG created from a JPEG photo

As you can see, HEIF/HEIC lossless compression provides significantly smaller files when compared to other lossless formats. As pointed above, better compression is just one of the benefits of this new format. Standardisation and a single format to all needs are other benefits.

HEIF is considerably more difficult to handle by programers. But this is a limitation that will be surpassed over time.

About patents, HEIF and HEVC are completely free if used as software only. It means your camera manufacturer will have to pay royalties to the format creators, but computer software creators and users are free to use it.

Having said that, we are wasting our time still using old inefficient image formats as JPEG, TIFF, DNG and PNG for most use cases. Lets move to HEIF/HEIC.

Original and converted pictures used in this analysis are here.


Posted

in

by

Tags: