<p>First off, it's worth noting that not all artefacts are regions of the same colour. <em>Artefacts</em> 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.</p>

<p>There are two popular metrics for specifying the losses, but they're <strong>not</strong> independent of the image content, and they measure the whole loss, not just structured artefacts. <a href="https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio" rel="nofollow noreferrer">PSNR</a> 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. <a href="https://en.wikipedia.org/wiki/Structural_similarity" rel="nofollow noreferrer">Structural similarity (SSIM)</a> is better because it takes the structure of the image and the errors into account in the measure.</p>

<p>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.</p>

<p>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.</p>

CC BY-SA 4.0
2018-07-17T10:43:59.080Z
2018-07-17T10:43:59.080Z
Dan Hulme
<p>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).
<br>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".
<br>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. <br></p>

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

CC BY-SA 4.0
2018-07-17T09:39:23.530Z
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?
Dan Hulme
CC BY-SA 4.0
2018-07-17T09:43:32.197Z
@Dan Hulme: I mean the final results. My idea is that it shall be independent from the algorithm.
mic
CC BY-SA 4.0
2018-07-17T09:55:22.337Z
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.
PaulHK
CC BY-SA 4.0
2018-07-17T10:39:53.353Z
@PaulHK: Of course. I just wanted to show that I've somehow understood how the actual compression works ;-)
mic
<image><compression>
Is there a general way how to specify the "image compression loss"?
mic
# Is there a general way how to specify the "image compression loss"?

(Asked by: username_0 on 2018-07-17)

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?

**Tags:** image, compression

> **Comments:**
> **username_1**: 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?  
> **username_0**: @username_1: I mean the final results. My idea is that it shall be independent from the algorithm.  
> **username_2**: 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.  
> **username_0**: @username_2: Of course. I just wanted to show that I've somehow understood how the actual compression works ;-)  

---

## 1 answers

### Answer by username_1 on 2018-07-17. Score: 1 | Accepted answer

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](https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio) 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)](https://en.wikipedia.org/wiki/Structural_similarity) 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.


---

