Page 2 of 2

Re: Difference between rotation and lossless rotation?

Posted: Fri Sep 18, 2009 8:12 am
by xnview
aussenboarder wrote: but i do not understand the following:
i did an experiment rotating an image with the 4 different modes.
the result is that only the "normal" mode of the viewer keeps the original data. the other modes cut off pixels whenever the image dimension aren't a multiple of 8 (?)
Yes it's the limit of jpeg lossless rotation
In Browser, regardless of "use lossless rotation when possible (jpeg)" option, when I click the "Rotate clockwise" toolbar button, nothing happens, image is not rotated, preview just blinks.
It's not normal, could you send me a sample?
In Viewer, if option "use lossless rotation when possible (jpeg)" is enabled, lossless rotation is not used when I use "Rotate clockwise" toolbar button, but image is rotated.
The option is only for browser mode

Re: Difference between rotation and lossless rotation?

Posted: Fri Sep 18, 2009 10:01 pm
by Dreamer
xnview wrote:
In Browser, regardless of "use lossless rotation when possible (jpeg)" option, when I click the "Rotate clockwise" toolbar button, nothing happens, image is not rotated, preview just blinks.
It's not normal, could you send me a sample?
It's the same with any JPG image, but I'll send it to you if you want.

BTW Still the same with 1.96.5.

Re: Difference between rotation and lossless rotation?

Posted: Fri Sep 18, 2009 10:36 pm
by bucky
aussenboarder wrote: why is the above described cut off happening?
what is so special about the 8 pixel multiple?
does it occur for both dimensions?
why are the rotation modes working different?
I believe JPEG is encoded in 8x8 blocks, so if the image is not a multiple of 8 pixels in either dimension, then it will be cut off during lossless JPEG rotation or cropping.

Re: Difference between rotation and lossless rotation?

Posted: Fri Sep 18, 2009 10:43 pm
by bucky
Dreamer wrote:In Browser, regardless of "use lossless rotation when possible (jpeg)" option, when I click the "Rotate clockwise" toolbar button, nothing happens, image is not rotated, preview just blinks.
That's not what happens for me. When I click "Rotate clockwise" button in browser, the image does lossless rotation.
Dreamer wrote: In Viewer, if option "use lossless rotation when possible (jpeg)" is enabled, lossless rotation is not used when I use "Rotate clockwise" toolbar button, but image is rotated.
This is correct, and Pierre said this is intended behavior.

Re: Difference between rotation and lossless rotation?

Posted: Fri Sep 18, 2009 11:43 pm
by aussenboarder
@Dreamer
maybe your problem has something to do with the orientation flag set in the exif data. i could imagine that the representation in the browser/viewer differs from what the "raw pixel data" of the image are. maybe someone can describe which program option could force such a behaviour. - remember this was just a guess 8}

@bucky
i can understand that image blocks consist of 8x8 pixels.
but that does not answer why the different rotations in my example produce different pictures.

Re: Difference between rotation and lossless rotation?

Posted: Sat Sep 19, 2009 9:00 am
by bucky
aussenboarder wrote: @bucky
i can understand that image blocks consist of 8x8 pixels.
but that does not answer why the different rotations in my example produce different pictures.
Here's the explanation of each one:
10x30 image
1. browser click lossless rotation -> performs lossless rotation -> result cropped
2. browser click normal rotation -> performs lossless rotation (because use lossless rotation option is checked) -> result cropped
3. viewer click lossless rotation -> performs lossless rotation -> result cropped
4. viewer click normal rotation -> performs normal rotation (lossless rotation option is ignored in viewer mode) -> result not cropped

24x32 image
1,2,3,4. All results not cropped because pixel is multiple of 8.

Re: Difference between rotation and lossless rotation?

Posted: Sat Sep 19, 2009 10:54 am
by aussenboarder
@bucky
exactly. thank you for the explanation: that makes it more clear.
but why are the normal and the lossless mode working different / are not both working on the basis of an 8x8 block?

Re: Difference between rotation and lossless rotation?

Posted: Sat Sep 19, 2009 3:24 pm
by bucky
aussenboarder wrote:@bucky
exactly. thank you for the explanation: that makes it more clear.
but why are the normal and the lossless mode working different / are not both working on the basis of an 8x8 block?
I believe that when doing normal/lossy rotation, the entire image is being rotated as one, then resampled/recompressed. When you resample, you can do any kind of manipulation you want (for example, rotate by 1 degree). You're basically creating a new JPEG file unrelated to the previous one.

With lossless jpeg rotation, basically, you're rotating each 8x8 block. But the leftover pixels cannot be rotated.
http://www.ammara.com/support/technolog ... ation.html

Re: Difference between rotation and lossless rotation?

Posted: Sat Sep 19, 2009 9:27 pm
by Dreamer
aussenboarder wrote:@Dreamer
maybe your problem has something to do with the orientation flag set in the exif data. i could imagine that the representation in the browser/viewer differs from what the "raw pixel data" of the image are. maybe someone can describe which program option could force such a behaviour. - remember this was just a guess 8}
That's it! I have removed EXIF from the image and it works good now! Anyway, it's a bug IMHO.