severity 355199 normal quit On Sat, Mar 04, 2006 at 12:55:11AM +0100, Marco Candrian wrote: > Package: libjpeg62 > Version: 6b-11 > Severity: critical > Justification: causes serious data loss > > jpegtran -rotate 180 source.jpg > target.jpg > > damages borders, see: http://www.calmar.ws/jpegtrans.png
Hello Marco, Your image size seems to be 1000x669 which are not multiple of 16 so it seems you triggered a documented jpegtran feature, see man jpegtran: The transpose transformation has no restrictions regarding image dimen- sions. The other transformations operate rather oddly if the image dimensions are not a multiple of the iMCU size (usually 8 or 16 pix- els), because they can only transform complete blocks of DCT coeffi- cient data in the desired way. jpegtran's default behavior when transforming an odd-size image is designed to preserve exact reversibility and mathematical consistency of the transformation set. As stated, transpose is able to flip the entire image area. Horizontal mirroring leaves any partial iMCU column at the right edge untouched, but is able to flip all rows of the image. Similarly, vertical mirroring leaves any partial iMCU row at the bottom edge untouched, but is able to flip all columns. The other transforms can be built up as sequences of transpose and flip operations; for con- sistency, their actions on edge pixels are defined to be the same as the end result of the corresponding transpose-and-flip sequence. Theses restrictions on lossless transformations are inherent to the JPEG image format, not to jpegtran. If you do not like the current behaviour, there is 3 ways around it: 1) use -trim, that will cut the image borders that cannot be rotated. 2) use -perfect, that will cause jpegtran to fail with an error when the image size does not allow for a perfect rotation. 3) use a lossy rotation when jpegtran -perfect fails, like in (jpegtran -rot 90 -perfect foo.jpg || djpeg foo.jpg| pnmflip -r90 | cjpeg) >PS: it's critical and causes serious data loss on application, where >the original picture gets overwritten with the rotated one - I hope >that counts) This is not correct. jpegtran does not cause any data loss because you can rotate back the image and the exact same image you started with. By contrast other JPEG rotations software will lose data due to the lossy compression, but I doubt you will consider that a serious data loss. Just try to do jpegtran -rotate 180 target.jpg > target2.jpg and compare source.jpg and target2.jpg Cheers, -- Bill. <[EMAIL PROTECTED]> Imagine a large red swirl here. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]