Is quality lost compressing .jpg files using -p100? - RealWorld forums

Log-in or register.

Is quality lost compressing .jpg files using -p100?

Teleg
on January 21st 2012

Sony DSC-W290 picture DSC03954.JPG has size 5.2MB. Image size 4000x3000. Without compression, it would take 34.3MB (4000x3000x24/8/1024/1024), assuming a pixel takes 24 bits. This says the camera's compression reduces the file size to 14.8% of the uncompressed size. But still, pictures of 5MB sizes or larger take a lot of space. I tried -p100:

 /cygdrive/c/bin/PhotoResize -m -o -r -e -p100 -i *

This picture's size is reduced to 1.1MB. I recorded the meta data using exiftool (found on the Web free) before and after, the only significant difference is this:

Before:

 Y Cb Cr Sub Sampling            : YCbCr4:2:2 (2 1)

After:

 Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)

Looked up on the Web and got the impression that YCbCr4:2:2 is better in quality than YCbCr4:2:0 since the latter is common in video. Gut feel tells me that it indicates quality loss. Visually comparing the bitmap using MS Paint indicates little difference; maybe the latter a little brighter or the contrast / shades of color is not as deep? My question is, does -p100 option incur any loss of quality (color or compression related degradation)? If not, -p100 would be a great lossless compression tool that all other Web articles are saying virtually impossible! If it does cause loss, this loss is not mentioned on the manual page; would like to see explanation.

BTW, I first added option +a+ on the command line above and all results are corrupt! It looks like a bug. I was just trying to compress it a bit more using -a+ but if -p100 does not lose quality (or even not much), I would be happy enough to jump up and down! This may compress 5 DVDs of pictures into 1 DVD for back-up.

We users are hard-pressed to determine the resolution -^X to resize to, unless we are resizing them for Web publishing or the like. We want to reduces the size as much as possible, or at least to the reasonable 1MB level, and yet we want to see quality lose as little (or none) as possible. If after compression, the loss of quality is unperceivable when displaying maxed on a 27" monitor, the loss may be considered small enough. The benefit of preserving virtually all quality is most apparent when you need to crop out a face from a group picture. -p100 (-p98, ...) is hopefully that automated decision maker! The -p100 option is just not promoted enough in tutorials and manual pages - too unfortunate.

This is such a great tool since it supports command line use and recursion! The above command line allows you to process all your pictures in the directory tree!

Vlasta
on January 22nd 2012

-p100 keeps the same pixel size, but re-compresses the image using different options. There are 2 options that influence quality and file size. There is some loss, but I would say, it is worth the saved file size.

  1. -qX swicth, where X is a number from 1 to 100. The higher the number, the less is lost and the larger the file. You can experiment with the value to find one that suits you. The default is 60, if you want very high quality, use -q90. I would not recommend higher numbers. If you do a blind test you will not be able to tell the difference.
  2. one of -x11, -x12, -x21, -x22 switches (-x22 is the default and hence the YCbCr4:2:0). JPG encodes brightness and color information separately and because the human eye is more sensitive to brightness change than to color change, the color information may be donwnsampled. -x22 means there is one color information for a block of 2x2 pixels. Sure, this means some information is lost, but it actually is not. What are the camera guys not telling you is the camera sensors do not have full color resolution anyway - they only sense 1 of the colors (RGB) per pixel and the other information is saved in the .jpg is actually interpolated. With current insane megapixel values, the lens are usually the limiting factor anyway. In short, you lose very little or nothing at all with -x22.

-a+ does not produce corrupted files. It produces valid files that only very few other programs understand at this time, because the algorithm required to support them was covered by a patent that only recently expired. In time, other applications will be updated and will be able to work with these files.

Page views: 10243       Posts: 2      
Select background
Vista & Win 7 icons
I wish there were...