On Thu, Aug 11, 2005 at 11:53:51PM -0700, David wrote: > Hey all, > > Finally I have a question for IrfanView users: I've been using the "JPG > Lossless Operations" command to rotate my images. I tested it first to > see if the file size changed or there were any visible image degradation > and I didn't notice any changes. Is the process truly "lossless"? If > it is, just out of curiosity, does anyone know how the process works? > From what I understood about JPG's is that every time you resave the > image it compresses a little more.
I'm not an IrfanView user, but I'll take a stab at this: Rather than saving pixels, a JPEG file saves a matrix of weights. In fact it stores many of these - one matrix for each 8x8 pixel block. The matrix of coefficients for an 8x8 block rotated by 90 degrees bears a very simple relationship to the matrix for the unrotated block. (Basically it contains all the same numbers, in a different order, exept that some of the coefficients end up with the opposite sign) Applying this simple transformation (and altering the order in which 8x8 sub-blocks are written out) yields an image rotated by 90 degrees. The lossiness in a JPEG image comes when you calculate the weights to represent an 8x8 pixel sub-block. For this operation there is no such calculation being done, so no additional losses are incurred.

