0
$\begingroup$

I am pretty much a begginer in matters of Image signal and to be honest, not that much versed into mathematics. I hope my question will not sound too naive. (sorry in advance)

(Also if it has been answered already, please redirect me to the correct thread)

Well my question is relating to JPEG quality in general.

rephrased question :

Let's imagine a JPEG with a quality under 100%. Let's say 70%.

If I re-encode this image with a quality of 100%, the weight increase a lot (it more than doubles up on my test with ImageMagick).

Obviously some data has been created, but the image can't be of better quality than the original 70% JPEG.

In the process there is what can be called "blank data" added: data that is not improving image.

How can we know if a given JPEG has an amount of such blank data ?

$\endgroup$
9
  • $\begingroup$ Honestly, I have a hard time really understanding your question(s). However it is clear that you concern about compression quality and "where the additional information goes". In general: Have you tried out your suggested experiments? Have you subtracted a 70% quality JPEG from the 100% one? Or from the original PNG... I assume you can learn quite a lot from doing that. $\endgroup$
    – M529
    Nov 26 '20 at 19:17
  • $\begingroup$ Hi @M529 Actually I have done both. My experiment is pretty much visual. Both 70% JPEGs (Whether from PNG or from 100% JPEG previously compressed to 70%) end up the same size (a difference of less than one KB, for a file 900 KB big). And visually identical to the eye (at 2000% observation). then I have been thinking that JPEG compression ratio returned by ImageMagick could potentially be misleading and include "blank" data rather than actual data. $\endgroup$
    – Maxence
    Nov 26 '20 at 19:36
  • $\begingroup$ What do you mean by "blank data"? Do you mean dead white or dead black, or any other large field of one color? I.e., a "blank area"? Or do you mean something else? "Blank data" has no widely accepted definition in signal or image processing, that I know of. $\endgroup$
    – TimWescott
    Nov 27 '20 at 21:36
  • $\begingroup$ Including the image that you're working with would be a help. The results of this sort of image processing depends heavily on the source image. $\endgroup$
    – TimWescott
    Nov 27 '20 at 21:36
  • $\begingroup$ Sorry my question isn't very easy to lay down. But well. Let's imagine a JPEG with a quality under 100%. Let's say 70%. If I re-encode the same image with a quality of 100%, the weight increase a lot (it more than doubles up on my test). Obviously some data has been created, but the image can't be of better quality than the original 70% JPEG. This is what I call the blank data: data that is not improving image. How can we know if a given JPEG has an amount of such blank data ? $\endgroup$
    – Maxence
    Nov 27 '20 at 21:56
1
$\begingroup$

The short answer is that the original encoding of a picture is lost when you re-encode it. So a tool that takes a 70% encoded picture and re-encodes it to 100% actually does the following:

  • Decode from 70% to an internal, raw, uncompressed format (similar to .bmp -- basically, it'll be encoded in RGB, probably 8 bits per pixel for each color).
  • Encode to 100%

Note two things here: that the encoding assumes nothing about the original image, and that changing the encoding of an image (even from "perfect" RGB to "100% quality" JPEG) is going to introduce scrud -- numerical errors that are for all practical purposes impossible to predict and degrade the image.

So your 70% image isn't perfect -- compared to the original it has numerical scrud. That -- plus a bit more because the conversion isn't perfect -- will be carried forward into the intermediate uncompressed image.

Then, during "compression" to 100% quality any numerical scrud that's in the intermediate uncompressed image will be treated as real image, not as numerical scrud. So when the intermediate raw image -- complete with numerical scrud -- is converted to 100% image quality jpeg, that numerical scrud will be replicated as faithfully as can be managed. Note that, because of the number of steps that the JPEG process goes through, even the best possible job you can do, that results in no compression at all, will still introduce its own scrud.

It actually gets worse than that, but not the way that your question addresses. If you take an image and compress it, then uncompress it, then compress it again, the second compressed image will be lower quality than the first. I honestly don't know if for certain levels of compression you'd reach some minimum of image quality at which the thing would no longer degrade, but I'm sure that if you were to compress to some slightly different image quality each time (i.e., choose a random number between 70% and 80% each time), that the image would just continue to degrade with compression -- even as the file sizes pretty much stayed the same for each compression level.

$\endgroup$
2
  • $\begingroup$ Thanks @TimWescott . Indeed I understand that the JPEG algorithm is taking my 70% JPEG as a new image. Then the compression artifacts are no longer artifacts but rather features of the image. But when you say that a compression adds random scrud. I am not sure this scrud is really random. And I am not even sure that compressing an image from 100 to 70 then to 100 and repeat this operation a number of times will add some amount of scrud in each process. I think the JPEG algorithm is pretty much non-stochastic and the scrud can be determined in advance ... $\endgroup$
    – Maxence
    Nov 28 '20 at 12:17
  • $\begingroup$ I will do more experiment to try to fine tune my point (or just discover that I am wrong).. Also regarding the extra data when moving from 70% to 100% quality, I am not sure an algorithm exist that could allow to determine if this blank data exists in any given image. I will try to process differently .. (basically compressing a given JPEG to any quality with a step of 1% and compare images between them and see if there is point where image quality is no more improved/degraded) $\endgroup$
    – Maxence
    Nov 28 '20 at 12:20

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.