Comparisons of lossy compression of HD Photo


Summary

This page addresses the question: "If we are prepared to accept a given loss of image quality, how do the file sizes of JPEG, JPEG 2000, and HD Photo, compare?".

For any given set of quality values, the HD Photo and JPEG 2000 files were about the same size, and significantly smaller than the JPEG file.

The method used here was to generate a TIFF file, derive various compressed files from it, then to examine the differences between the histograms of the TIFF file and those derived from it. I do not know how reliably this predicts perceived image quality. So while this may contribute to an understanding of how good HD Photo's compression is, it can only be part of the story. I've provided some image extracts to allow others to make their own judgment.

(The tests used an early Beta version of the HD Photo Photoshop plug-in, not the one released on 17/18 August 2007. Two comparisons between the earliy and the latest versions have shown identical results for the same value of "Quality", so the tests remain valid).


Results

For various JPEG "Quality" values, this table shows the file sizes of the JPEG itself, and of JPEG 2000 and HD Photo files which appear to have similar "quality values" when their histograms are compared. There are three such quality values, see next paragraph, and they don't vary consistently, so a judgment was needed about the best match. The quality values and file sizes almost certainly depend on the original image, so there is little to be gained from examining detailed differences.

The Mean, Std Dev, and Median, also called "quality values" in the table below, come from Photoshop's histograms, (see Details later), and are measures of aspects of loss of image quality compared with the 16-bit TIFF file from which all the compressed files were generated. "0" means "no loss", while larger values mean greater loss. (Caution: Photoshop's histogram statistics are designed for 256 levels, and with 16-bit images there may be variations within the "0" level that won't show in the statistics).

Photoshop's JPEG "Quality" Type Histogram quality values

File size

MB

Commentary
Format "Quality" Mean Std Dev Median

JPEG "quality" = 12

Extract of these images

JPEG 12 0.6 0.63 1 7.3

These are similar quality values.

HD Photo size: 47%.

JPEG 2000 007 0.52 0.62 0 3.5
HD Photo 0.3 0.57 0.64 0 3.4
JPEG "quality" = 11 JPEG 11 0.82 0.84 1 4.2

These are similar quality values.

HD Photo size: 57%.

JPEG 2000 005 0.7 0.75 1 2.5
HD Photo 0.25 0.78 0.79 1 2.4
JPEG "quality" = 10 JPEG 10 1.02 1.04 1 2.6

These are similar quality values.

HD Photo size: 62%.

JPEG 2000 003 0.99 1.01 1 1.5
HD Photo 0.2 1.06 1.00 1 1.6
JPEG "quality" = 9 JPEG 9 1.25 1.26 1 1.8

These are similar quality values.

HD Photo size: 61%.

JPEG 2000 002 1.22 1.24 1 1.0
HD Photo 0.16 1.26 1.18 1 1.1
JPEG "quality" = 8 JPEG 8 1.46 1.49 1 1.4

The HD Photo quality values are similar to JPEG. The JPEG 2000 quality values are better.

HD Photo size: 62%.

JPEG 2000 002 1.22 1.24 1 1.0
HD Photo 0.13 1.49 1.38 1 0.87
JPEG "quality" = 7

Extract of these images

JPEG 7 1.76 1.76 1 1.1

These are similar quality values.

HD Photo size: 60%.

JPEG 2000 001 1.66 1.68 1 0.53
HD Photo 0.1 1.73 1.59 1 0.66
JPEG "quality" = 6 JPEG 6 1.63 1.75 1 1.0

These are similar quality values.

HD Photo size: 66%.

JPEG 2000 001 1.66 1.68 1 0.53
HD Photo 0.1 1.73 1.59 1 0.66
JPEG "quality" = 5 JPEG 5 1.97 2.01 1 0.78

The HD Photo quality values are similar to JPEG.
The smallest JPEG 2000 is "001", so its quality values are better.

HD Photo size: 67%.

JPEG 2000 001 1.66 1.68 1 0.53
HD Photo 0.07 1.94 1.78 2 0.52
JPEG "quality" = 4 JPEG 4 2.13 2.17 2 0.65

The HD Photo quality values are similar to JPEG.
The smallest JPEG 2000 is "001", so it is omitted.

HD Photo size: 66%.

HD Photo 0.05 2.10 1.94 2 0.43
JPEG "quality" = 3 JPEG 3 2.32 2.36 2 0.56

The HD Photo quality values are similar to JPEG.
The smallest JPEG 2000 is "001", so it is omitted.

HD Photo size: 57%.

HD Photo 0.03 2.34 2.18 2 0.32
JPEG "quality" = 2

Extract of these images

JPEG 2 2.43 2.46 2 0.43

The HD Photo quality values are similar to JPEG.
The smallest JPEG 2000 is "001", so it is omitted.

HD Photo size: 63%.

HD Photo 0.01 2.51 2.33 2 0.27

Image extracts

Four Photoshop (PSD) files can downloaded so that a visual rather than a statistical comparison can be made. Caution: they range in size from about 1.3 MB to about 2.7 MB.

They hold 600 x 400 pixel extracts from the 4992 x 3328 pixel images used throughout these tests. These extracts are all from precisely the same place in the original image, so it is easy to do on-screen comparisons. These files were all converted from 16-bit to 8-bit immediately before uploading, to make them faster to download. That shouldn't make any detectable difference to what can be seen on-screen.

  • extract_original.psd: This is an extract from the original 16-bit TIFF file from which all other image files used in this tests were derived. I've made it a separate file to avoid including it as a layer in each of the files below, but it is intended to be copied as a separate layer into each of the image files below for comparison purposes.
  • extract_comparison_12.psd: This has three layers, corresponding to the HD Photo, JPEG 2000, and JPEG files summarised in the table above for "JPEG quality = 12".
  • extract_comparison_07.psd: This has three layers, corresponding to the HD Photo, JPEG 2000, and JPEG files summarised in the table above for "JPEG quality = 7".
  • extract_comparison_02.psd: This has two layers, corresponding to the HD Photo and JPEG files summarised in the table above for "JPEG quality = 2".

My subjective conclusion, from comparing (on-screen) the original images (and these extracts), is that even when HD Photo and JPEG have similar histogram statistics, the JPEG images have nastier artefacts. This means that HD Photo could typically be compressed a little more than the above table would suggest and still compete with JPEG.


Method

All image files were derived from the same uncropped CR2 raw file. This was opened in ACR 4.1 then opened in 16-bit mode in Photoshop CS3. It was converted to sRGB colour space for all subsequent tests, and a 16-bit TIFF was saved for all the following tests.

HD Photo comparisons

The 16-bit TIFF was "Saved As ... HD Photo" many times, using the "Basic Settings" with values of "Quality" from 0 to 1.

Each of these derived HD Photo files in turn was opened and copied as the 2nd layer to that same 16-bit TIFF. The "Blending mode" of the copied layer was set to "Difference".

Screen shots were made of the resultant histograms for each "Difference", and are shown in the table below. (The results for "Quality" values higher than 0.7 are not shown, because, like 0.7 itself, they all showed no apparent loss).

JPEG 2000 comparisons

The 16-bit TIFF was "Saved As ... JPEG2000 " many times, with values of "Quality" from 001 to 100.

Each of these derived JPEG2000 files in turn was opened and copied as the 2nd layer to that same 16-bit TIFF. The "Blending mode" of the copied layer was set to "Difference".

Screen shots were made of the resultant histograms for each "Difference", and are shown in the table below. (The results for "Quality" values higher than 040 are not shown, because, like 040 itself, they all showed no apparent loss).

JPEG comparisons

An 8-bit TIFF was derived from the 16-bit TIFF, and the 8-bit TIFF was "Saved As ... JPEG" 13 times, with values of "Quality" of: 0, 1 .... 11, 12.

Each of these derived JPEG files in turn was opened, converted to 16-bits, and copied as the 2nd layer to the 16-bit TIFF. The "Blending mode" of the copied layer was set to "Difference".

Screen shots were made of the resultant histograms for each "Difference", and are shown in the table below. (JPEG Quality values of 0 and 1 are not shown in the Results table above, because neither JPEG 2000 nor HD Photo could be degraded to those JPEG image qualities!)


Details

Each of these is a histogram of the "Difference" (blending mode) between a 16-bit TIFF file and a file derived from it by some form of lossy compression.

Original file sizes

A CR2 (from a Canon IDs Mark II at ISO 100, about 16 MP) was 17.6 MB. (A DNG from that was 14.8 MB). These sizes are significant - use of JPEG XR in-camera would surely be expected to be significantly less than these sizes?

The 16-bit TIFF (uncompressed) was 97 MB. The 8-bit TIFF (uncompressed) was 48 MB.

Histograms after "Difference" blending mode

These are in the order: HD Photo; JPEG; JPEG 2000. (The "ideal" for Mean, Std Dev, and Median, in the table below, is 0, which means "no loss", while larger values mean greater loss).

HD Photo (Early Beta Photoshop plugin)

Quality: 0.7. Size: 20.0 MB.

Quality: 0.6. Size: 14.4 MB.

Quality: 0.5. Size: 9.9 MB.

Quality: 0.4. Size: 6.2 MB.

Quality: 0.3. Size: 3.4 MB.

Quality: 0.25. Size: 2.4 MB

Quality: 0.2. Size: 1.6 MB.

Quality: 0.16. Size: 1.1 MB.

Quality: 0.13. Size: 0.87 MB

Quality: 0.1. Size: 0.66 MB.

Quality: 0.07. Size: 0.52.

Quality: 0.05. Size: 0.43 MB

Quality: 0.03. Size: 0.32.

Quality: 0.01. Size: 0.27 MB.

Quality: 0.0. Size: 0.25 MB.

 
JPEG (Photoshop "Save As")

Quality: 12. Size: 7.3 MB.

Quality: 11. Size: 4.2 MB.

Quality: 10. Size: 2.6 MB.

Quality: 9. Size: 1.8 MB.

Quality: 8. Size: 1.4 MB.

Quality: 7. Size: 1.1 MB.

Quality: 6. Size: 1.0 MB.

Quality: 5. Size: 0.78 MB.

Quality: 4. Size: 0.65 MB.

Quality: 3. Size: 0.56 MB.

Quality: 2. Size: 0.43 MB.

Quality: 1. Size: 0.33 MB.

 
JPEG 2000 (Photoshop "Save As")

Quality: 040. Size: 19.9 MB.

Quality: 030. Size: 14.9 MB.

Quality: 015. Size: 7.5 MB.

Quality: 010. Size: 5.0 MB.

Quality: 007. Size: 3.5 MB

Quality: 005. Size: 2.5 MB.

Quality: 003. Size: 1.5 MB.

Quality: 002. Size: 1.0 MB.

Quality: 001. Size: 0.53 MB.