For JPG, i can choose the "quality" from 100 to 0, which means that any pixel information is divided by 1 (quality = 100) or a very high number (quality = 0).
This results in less or more "artifacts", which are regions of the same color. The sizes of that regions depend on the image content and the selected "quality level".
But there are other compression formats using other algorithms. The common characteristic is that the resulting image has less information than the original uncompressed data.

Is there any way to specify those losses independently from both the used file format and the image content?

  • $\begingroup$ When you say "specify those losses", do you mean as an input to the algorithm, or are you looking for a way to measure how good the final result is? $\endgroup$
    – Dan Hulme
    Jul 17, 2018 at 9:39
  • $\begingroup$ @Dan Hulme: I mean the final results. My idea is that it shall be independent from the algorithm. $\endgroup$
    – mic
    Jul 17, 2018 at 9:43
  • $\begingroup$ You can use your own quantisation tables in JPEG. The 0-100 quality level is software-defined and depends on which software you're using. $\endgroup$
    – PaulHK
    Jul 17, 2018 at 9:55
  • $\begingroup$ @PaulHK: Of course. I just wanted to show that I've somehow understood how the actual compression works ;-) $\endgroup$
    – mic
    Jul 17, 2018 at 10:39

1 Answer 1


First off, it's worth noting that not all artefacts are regions of the same colour. Artefacts just means structured errors introduced by the compression, as opposed to noise or blurring. JPEG artefacts include flattened colours as you mention, but also edges introduced at block boundaries, and "ringing" around sharp edges in the image.

There are two popular metrics for specifying the losses, but they're not independent of the image content, and they measure the whole loss, not just structured artefacts. PSNR is most commonly used to quantify the loss of image and video compression algorithms. It's not a very useful measure, because it measures the absolute reconstruction error: it doesn't take into account what kind of artefacts are introduced and how they appear. Structural similarity (SSIM) is better because it takes the structure of the image and the errors into account in the measure.

The measure can't be independent of the image, for several reasons. Different images are easier or harder to reconstruct. For example, a completely flat colour will be perfectly reconstructed even with some very lossy algorithms and parameters. At the opposite end, completely random white noise will suffer some loss in almost any algorithm. Some images just contain more information than others. In addition, different domains have different requirements, so algorithms can be tuned for different kinds of images. JPEG is tuned for photographs, and performs badly on hard-edged synthetic images like diagrams. A texture compression algorithm might be tuned specifically to avoid block artefacts for tileable textures. JBIG2 is tuned for black-and-white document scans. A single generic measure wouldn't help you to understand the performance of the algorithm on the kind of image you're interested in.

To get a broader measure, it's common for researchers to quote a mean PSNR and/or SSIM measured across a corpus of images. The Kodak PCD0992 corpus has been used for many years, so it's an easy way to compare different papers, but it is waning in popularity now.


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.