Thursday, January 13, 2005
Independent JPEG Group offers lossless JPEG optimization
My previous post talked about some new software which can compress JPEGs losslessly by up to 30% when adding them to an archive. This got me thinking about how this might be achieved, and the obvious place to experiment seemed to be the widely used Independent JPEG Group's jpeg library.
Looking through their offering, I noticed the jpegtran program, which is able to perform lossless transforms on JPEG files - such as rotation without performing the decompression and recompression which most other image processing apps do to do this.
I also found that this program offers an -optimize parameter, which the help says performs "Optimize Huffman table (smaller file, but slow compression)". The relevant command line is "jpegtran -optimize -copy all in.jpg out.jpg". Running this on a number of files showed that even this simple operation makes a big difference to the file size:
Note that I am still ending up with a perfectly valid jpg format file - loadable in any image processing package. This is not what Stuffit are doing - they are trying to introduce a new image format that is incompatible with existing image processing programs.
It's certainly been an eye opener for me - I'll be reprocessing all the images on my website to take advantage of the better compression this simple operation gives me.
Looking through their offering, I noticed the jpegtran program, which is able to perform lossless transforms on JPEG files - such as rotation without performing the decompression and recompression which most other image processing apps do to do this.
I also found that this program offers an -optimize parameter, which the help says performs "Optimize Huffman table (smaller file, but slow compression)". The relevant command line is "jpegtran -optimize -copy all in.jpg out.jpg". Running this on a number of files showed that even this simple operation makes a big difference to the file size:
- A random image off my 6 mega pixel digital camera was reduced in size from 3,440,482 bytes to 3,241,415 bytes - that's a 6% saving
- A "web optimized" (ie low quality factor) 430 x 300 pixel image I have on a website was reduced in size from 13,174 bytes to 11,624 bytes - thats an even better percentage saving of almost 12%
Note that I am still ending up with a perfectly valid jpg format file - loadable in any image processing package. This is not what Stuffit are doing - they are trying to introduce a new image format that is incompatible with existing image processing programs.
It's certainly been an eye opener for me - I'll be reprocessing all the images on my website to take advantage of the better compression this simple operation gives me.