jpegtran claims to losslessly rotate and crop JPG images. Neat trick - instead of modifying and recompressing the image, jpegtran just fiddles the vectors.
Only it doesn't work, at least according to the Gimp. Above is the difference between the original image and the one passed through jpegtran. I've boosted the gain a lot - the difference histogram is the image on the upper right. The differences had pixels as much as 17/255 white! It should be all black.
Is this a flaw inherent in jpegtran? Is it an artifact of the Gimp's jpeg decoder? It's not just jpegtran; Canon's own software has the same artifacts. And I don't think it's just the Gimp; I get the same results with djpeg and pbmplus.
Update: I got a great response from Guido explaining what's going on. JpegTran is lossless, in the sense it is reversible - re-rotate the image with jpegtran and you get the identical pixels. The differences above are because of jpeg decoding. For example, camera jpeg images are often 2x1 chroma subsampled. When you rotate them that becomes 1x2 and the decoder acts a bit differently.
This entry has moved to