3

After having read the GIMP Export Image as JPEG section, I still have one understanding issue:

Why am I able to select a higher quality value than the one from original image in the export dialog?

For example, given a .jpeg image, the quality slider is first set to the default 90. When marking "Use quality settings from original image", the value is set to 75. I can now still select slider values > 75, which creates the impression to raise the quality above original image.

With that assumption in mind (which may be wrong, I am happy to be corrected here), this dialog does not make sense to me. JPEG is a lossy format and an image with lower quality cannot be magically transformed to a higher-detail image. Also, the value seems to indicate some kind of "absolute quality", not a relative one - otherwise the original quality would be 100.

Edit

It seems, the biggest source of confusion has been the GIMP tooltip itself for me. Here are some screenshots, to show what I mean:

1. This is the default export as jpeg screen with image quality of 90

enter image description here

2. After having marked "use quality settings from original image"

enter image description here

Quality slider is automatically adjusted to 75 here. Tooltip says, its (almost) same quality, which let me assume, that

  1. it is an (almost) losless conversion
  2. 75 is some kind of absolute, computed quality indicator and means 100% quality preserveation in relative terms
  • 1
    The "higher quality than original image" is related to GIMP's user interface / tooltip display. Updated question for clarifications – bela53 Jul 16 at 9:00
  • If none of the answers is what you were looking for, you should post your answer as an answer (answering your own questions is perfectly fine) and choose that as the accepted answer rather than editing your question to include the answer. – L. Scott Johnson Jul 16 at 11:31
  • @L.ScottJohnson I already upvoted suitable answers (including yours), waiting some time to accept the best post should be perfectly fine. The question update is rather meant to give some additional clarification. – bela53 Jul 16 at 11:45
5

After loading the image, Gimp is just working with the grid of pixels, which now include noise/artifacts from that first save (as well as noise/artifacts from the original sensor and any processing done in-camera).

When you go to save in Gimp, you're selecting how much more degradation you're willing to allow in saving the current batch of pixels (or to put it another way, how much fidelity you want to preserve of the current noise/artifacts).

From this post in Lifewire

If I Compress a JPEG at 70 Percent and Later Reopen It and Compress It at 90 Percent, the Final Image Will Be Restored to a Quality Setting of 90 Percent: False

The initial save at 70 percent introduces a permanent loss in quality that can't be restored. Saving again at 90 percent only introduces additional degradation to an image that has already had a considerable loss in quality.

| improve this answer | |
  • 1
    Not completely true. If you resave the very same image at Q=70, there will be very little difference with the original, because the algorithm will more or less "walk in its own tracks. If you shift the image by a few of pixels (not a multiple of 8), then the JPG blocks are different and you get a very different result. – xenoid Jul 15 at 19:42
  • You start by saying "Not completely true." and then go on to describe exactly what I said (plus the bit about shifting the image), so I'm not sure which you mean. If you have a citation to a source that says GIMP will perfectly preserve every pixel when re-saving, please share it and I'll update my answer to include that little miracle. – L. Scott Johnson Jul 15 at 20:12
  • There is a lot of difference depending on what has been done to the image. If you only do local edits and resave at quality 70 (tick the "use quality settings from orginal image) you'll be surprised by the very small difference with the original image in the parts that were not edited. And the difference decreases each time you load/export. Try yourself. I also have a script to demonstrate this with ImageMagick. This is used in image forensics, recently edited parts change more when the image is resaved. – xenoid Jul 15 at 20:26
  • 1
    Yes to all of that. I agree. The question of how much difference is tangential to the question, though. It seems though you're confusing "very little difference" as being mutually exclusive to my answer that it is not lossless and certainly won't necessarily undo previous loss. – L. Scott Johnson Jul 15 at 20:34
  • Thanks, that makes sense. I updated question for some clarifications. @xenoid I think, your comments are valid. There is a link in the comments of one deleted answer here, that exactly explains and supports your statement with a bit more in-depth infos. Unfortunately, I cannot access it anymore. You seem to have enough rep to see deleted answers - could you add the link here as comment? – bela53 Jul 16 at 8:57
2

Because Gimp makes no assumption about what you did to the image. Several cases where it makes sense:

  • You load a low-quality image to serve as a background to which you add high-quality elements. A typical case is adding text to an image, text is very vulnerable to compression...
  • You save the image after cropping it by something which is not a multiple of 8 pixels along the leading edges: the 8x8 blocks of the JPEG encoding are shifted, the compression artifacts are not re-encoded the same way and are just like other pixels, so compression artifacts apply to them. There is a non-negligible difference between the two images. Below, the image of a plane (Q=70), cropped with an origin shifted by 3x5 pixels, re-saved with Q=70 and Q=95. Showing the (re-aligned) difference with the original, thresholded at 15. Needless to say, Q=70 is at the top.

enter image description here

But really, low-quality JPGs are not meant to be re-edited.

Special case: if you:

  • only do local edits (removing blemishes, etc)
  • do not shift the origin of the image when cropping (or shift it by multiples of 8 pixels)
  • tick the Use quality setting from original image

... then there will be very little re-compression loss on the parts that were not edited.

| improve this answer | |
  • Thanks! Regarding special cases: Is there a difference between 1) Use quality setting from original image with quality 75 2) quality 75 alone? Your statement reads, as if GIMP does some special tricks to keep loss minimal despite quality of 75. – bela53 Jul 16 at 9:39
1

This is exactly why people complain about JPEG degradation.

When an image is saved as JPEG, the JPEG compression is free to discard details so that the image takes less space. The quality setting controls how close the output image is to the original. With it set to 100, there is the possibility of loss of precision that leads to reduction of details. See this answer for details. Keep in mind that the compression may not remove any detail if it happens to be well represented, for example an image made of just a single color throughout.

Once a JPEG is loaded, its pixel data is available in the application for editing but that is only the pixel data that is in the file. Anything that was discarded when creating that JPEG, is gone.

Saving the image again after editing results in another pass of the JPEG compressor. Again, any quality level can remove more details, so even if you ave at higher quality than the original you will never have more details but it is likely that further details are lost. It is not exactly multiplicative but if you have a quality 75 image from one that was already quality 75%, the result is a lower quality image even though the number is the same.

| improve this answer | |
  • 1
    If you use the same encoder and parameters on the same image, the artifacts "settle" rather quickly and there is no further degradation after a few steps. So you can avoid degradation on parts of the image you didn't alter (some photo editors even make a point of re-using the encoded data of the original whenever possible). – xenoid Jul 15 at 19:38
0

The compression quality setting indicates the accuracy with which Gimp tries to preserve its in-memory image when saving.

I can make an ultra-high quality recording of a mobile phone call. That does not make the phone call sound any better. It also does not make it deteriorate further, like sending it over a mobile phone connection again would likely do.

But it will take a larger file size to represent the quality of a small file.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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