2

I googled whether HEIC images are lossless or lossy, and whereas some articles and forum threads insist HEIC images are lossy, other insist that HEIC supports both lossy and lossless compression, but don't provide any details about how to use the latter. I use the latest Ventura, and when I edit HEIC images in Preview (and even if I chose "Lossless" when saving),

enter image description here

their quality degrade. So how to create HEIC images that won't degrade when I edit them?

1
  • 2
    Preview is a horrible app. If you are concerned about lossy/lossless you are not the user Preview is designed for. Preview is merely to look at* photos and PDFs. It is not, and has never been, remotely capable of quality editing. First, use something better.
    – Scott
    Nov 5, 2023 at 22:50

2 Answers 2

2

Let me try to address the contradiction if it is lossless or not.

Here is a screen capture of the Gimp dialog when exporting to HEIC. Note the words used: Nealry lossless.

enter image description here

And here is a specific test.

The full method I use is here, (I have not made an updated English version).

  1. The reference image
  2. The HEIC image over the reference test with the "difference" filter, and then levels modified to contrast pixels.
  3. A comparative using a file with some compression.
  4. A graph showing the levels of the comparative file. If the pixels were clamped to the left the "difference" file is totally black, meaning no difference.

enter image description here

On this specific test, using the "Nearly lossless" actually produces an identical copy of the original image. But in some other tests I did, I noticed a small change in the pixels. I need to do more extensive testing.

My conclusion in the first part of the question is that the algorithm can produce a lossless image in some circumstances, and a Nearly lossless on others.

The "official" posture is that it has lossless. https://nokiatech.github.io/heif/technical.html

However, the posture of some implementations is that it does not have a fully lossless compression.


Don't provide any details about how to use the latter

In the case of Gimp, just use the checkbox.

So how to create HEIC images that won't degrade when I edit them?

Here is the real question. Do not use a lossless file format when editing.

There are 3 main types of files used in photography.

  1. The original file. If quality matters you will save a RAW file, which is your original original. In some cases where you forgot to use RAW, or you can not use it, the JPG right out of the camera will be your original.

  2. The editing file. It can be the processing data on a developing software like Lightroom or in some cases the native file format of your editing application. PSD for Photoshop, XCF for Gimp, etc. That is the file format you should use.

  3. The delivery file. When you finish editing your image, you export it to either JPG, HEIC, WebP, PNG, TIF, or whatever format you need.

When you need additional editing, you use your native file format and then export a new delivery file.

Some people use lossless file formats like PNG to work with the files, but if you used layers, masks, etc, you actually will lose them on the "lossless" file.

https://www.pexels.com/es-es/foto/enfoque-selectivo-foto-de-retrato-de-mujer-posando-1906830/

0

As @jsx97 mentioned HEIC, Preview and Ventura, most likely meaning macOS Ventura, I'd conclude they're in the Apple ecosystem.

If that's true, then in practice, that means lossy or lossless is a question that really could be asked a lot further upstream - e.g. how is this HEIC image first generated? What exactly is inside that file?

For example, by default out of the box, an iPhone 7 or later would store its photos as lossy HEIC (more precisely as HEVC in an HEIF container, see Apple Support and Wikipedia HEIF). Then perhaps @jsx97 might complete edits in Preview.

So if that's the workflow, I'd intuit that I think @jsx97 really wants to start with Apple ProRAW.

Why? To risk oversimplifying a very nice though very detailed Understanding ProRAW article, lossy compression is applied to an image at Step 3: Optimize, already, so I'd understand why Apple wouldn't attempt to maintain a needlessly lossless workflow beyond that point - lossy and the 10 to 12 times smaller file size is a better trade off for the masses. Then whether it's GIMP, Halide, Lightroom, Photoshop, Preview or something else to edit, it'll have the potential to yield results which lossy/lossless could have a meaningful effect on.

The other clue I see in the screenshot was 38KB for lossless, which is far too small for a photo and suggests some kind of icon or artwork - in which case SVG or PNG as purely lossless image formats could be better intermediate options.

But in truth, we don't know, so I'll speculate no further.

Of course, if @jsx97 clarifies the question, it may yield a better recommendation.

P.S. This might be better on https://softwarerecs.stackexchange.com/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.