Forum: Poser - OFFICIAL


Subject: Sorta OT, but pertaining to Poser: jpegs vs. png's vs. tiff

jartz opened this issue on Nov 24, 2010 · 71 posts


johnpf posted Wed, 24 November 2010 at 6:50 PM

I've got no horse in this race, but I carried out a little experiment and... well... it was rather interesting what I found. Okay, interesting to me.

 

Successive JPEG Compressions - A short experiment

John Flynn, 24 Nov 2010**
**

Aim

To investigate the claim that serial JPEG compressions at a fixed compression rate will have a cumulative effect on each generation of saved (i.e., compressed via JPEG algorithms) images.

 

Hypothesis

I will begin with the hypothesis that the quality of a compressed image saved via JPG compression at a fixed compression rate will decrease, evident from a visual examination for JPEG artifacts and supported by the expected decrease in file-size of each successive compression.

 

Method

  1. I took an image at random from a collection of scanned photographs that I had already on my computer's hard drive. My only criterion for selecting an image that it be a JPEG file that had already undergone compression. This I designated the source image, and it can be found here:

http://www.mannyslife.co.uk/img/DialysisUnit01.jpg

  1. I opened the software application "Paint Shop Pro 7" and opened the source image.

  2. Without altering the picture in any way, I opened the "Save As..." dialog and ensured that the file-save format was set to "JPEG - JFIF Compliant (*.jpg, *.jif, *.jpeg)", thus enabling the file to be compressed via the JPEG compression method.

  3. I opened the "Options" dialog and chose "Run Optimizer" to open a more detailed window in which the compression ratio and the resulting file-size would be displayed.

  4. I entered "15" into the "Set compression value to" field. On previous uses of this option, I had noted that the allowed values are from 0 to 100, and as this value increases the expected file-size decreases, thus leading me to deduce that the value entered in this field results in the JPEG compression rate being "100 - value". This gave me a JPEG compression rate of 85% using this (unconfirmed) calculation. The actual figure is not of importance to the final results but I have documented it for reference. If the calculation proves to be incorrect, then the figure of 85 should be amended to the new value but the results and conclusion will remain unaffected.

  5. I saved the image but first incrementing the number contained in the filename by 1, creating a file named DialysisUnit02.jpg.

  6. I closed my source file and opened the most recently saved DialysisUnit02.jpg image.

  7. I repeated steps 3 to 7 with each successive filename being incremented by 1 and stopping when I had created DialysisUnit15.jpg.

  8. I opened my source image and DialysisUnit15.jpg for a visual comparison.

 

Results

All 15 images in the series can be found here:

http://www.mannyslife.co.uk/img/DialysisUnit01.jpg 68125
http://www.mannyslife.co.uk/img/DialysisUnit02.jpg 68090
http://www.mannyslife.co.uk/img/DialysisUnit03.jpg 68108
http://www.mannyslife.co.uk/img/DialysisUnit04.jpg 68085
http://www.mannyslife.co.uk/img/DialysisUnit05.jpg 68093
http://www.mannyslife.co.uk/img/DialysisUnit06.jpg 68091
http://www.mannyslife.co.uk/img/DialysisUnit07.jpg 68091
http://www.mannyslife.co.uk/img/DialysisUnit08.jpg 68093
http://www.mannyslife.co.uk/img/DialysisUnit09.jpg 68082
http://www.mannyslife.co.uk/img/DialysisUnit10.jpg 68100
http://www.mannyslife.co.uk/img/DialysisUnit11.jpg 68089
http://www.mannyslife.co.uk/img/DialysisUnit12.jpg 68089
http://www.mannyslife.co.uk/img/DialysisUnit13.jpg 68089
http://www.mannyslife.co.uk/img/DialysisUnit14.jpg 68089
http://www.mannyslife.co.uk/img/DialysisUnit15.jpg 68089

During the saving process, I noticed that the file-size was not changing as my hypothesis had predicted. I noted down the number of bytes that each image would be after compression and they are recorded in the table above in the second column.

For the visual comparison, I loaded the source image and the final iteration of the compressed images, and viewed them with unaided eyes at 1:1 magnification and then at 4:1 magnification in order to see individual pixels.

During the visual inspection with unaided eyes, at 1:1 magnification, I could detect no noticeable differences. At 4:1 magnification, I could detect no noticeable differences.

I then copied the source image to the clipboard and pasted it as a second layer on the final iteration image (DialysisUnit15.jpg). I changed the blend mode for this layer to Difference, opacity untouched at 100%. The Difference blend mode displays the result of subtracting the pasted image from the underlying image, thus removing any similarities shared by both images and leaving only the pixels that are different and their RGB components containing the magnitude of that difference.

The saved image resulting from the Difference blending can be found here:

http://www.mannyslife.co.uk/img/DialysisUnitDIFF.png

After performing the Difference blending, on a visual examination with unaided eyes at 1:1 magnification, I was presented with what I believed to be a completely black (RGB = 0, 0, 0) image. I magnified the image to 4:1 and, after chosing several random areas of the image, could find no areas that were anything but black.

Using the colour picker tool, I swept the mouse cursor across several random areas of the image and noticed that the RGB values of the displayed image were not 0, 0, 0 as I had expected from my visual examinations, but were values ranging from 0, 0, 0 to 2, 2, 2. Please note, this was the result of a non-methodical, random sampling of the image.

 

Conclusion

On visual inspection, I could see no difference between the source image and the final iteration of the compression series. This leads me to believe that an unmagnified (1:1) image that has undergone 15 successive JPEG compressions will appear identical to most viewers looking at the image with unaided vision.

After performing the Difference blending and examining the resulting image with the colour picker tool, I can see proof that there are differences, but they are so small that they are imperceptible to anyone viewing the 15th iteration image under normal circumstances.

These conclusions are supported, I feel, by an examination of the file-sizes recorded for each generation of the compression series. There is a clear difference in file-size between the source image and the 15th iteration image, but the difference is only 36 bytes. If my starting hypothesis had been true, I would have expected a much larger difference as each successive compression generation would be reducing the quality (and thus, I would have expected, the file-size) by 15% each time a compression was performed.

From the file-sizes noted, I am led to further hypothesize that, because the series of compressions is apparently converging on one file-size, the JPEG compression algorithm is not reducing each generation's quality by 15% in a linear manner and, instead, reaches a point (as defined by the specifics of the compression algorithm) beyond which a fixed compression rate will not make any further reductions in quality or file-size.