09 December 2006 3 comments Linux
I have an application where I need to resize huge digital camera pictures down to 800x600 pixels. To do this I used ImageMagick's convert program which I feel gives much better quality than Python PIL. To reduce the file size I make sure I use the
-strip option to
convert but the really interesting question was what quality option should I use?
Goal: the image should be as small (in bytes) as possible without too reduced in picture quality.
To get the optimal picture quality of course the right option is
-quality 100 and to get the smallest file size I should use
-quality 10. To find out what quality setting to use I converted an original image with the following command 10 times:
convert vase.jpg -strip -quality <X> -resize 800x600 vase.quality-95.jpg
<X> is the varying value between 10 to 100.
Plotting the filesize in a graph gives a pretty clear picture about the quality setting. Clearly the file size drastically increases when you go above 90%. My conclusion, use
To see the result of each conversion, I've uploaded all output images so you can compare yourself.
I just realised that good old Gimp, sets the JPEG export quality to 85% by default. Could it be for the same reasons that this little analysis that I did?