I know that lossless JPEG rotation is only possible on images where width and height are a multitude of 8 pixels.
However, there seems to be another condition for lossless rotation also, and I can't figure out what it is.
If I take an unedited JPEG photo from my camera, choose "Convert Image" from the context menu, set JPEG quality to "1" (to clearly see if lossless rotation is performed or not), check Rotate (set to 90 degrees), check "Write to destination folder", and uncheck everything else, then the resulting image is clearly rotated without image loss.
However, if I take the same original image, and first do a conversion where I only check "Convert" (set to JPEG), with quality set to 75 (this way I force a re-write of the image), and then perform the above steps to rotate (again with quality at 1), then I clearly get a recompressed image.
Apparently, in the plain JPEG-to-JPEG conversion, something is changed in the image which makes it so that DO no longer performs a lossless rotate on the resulting image!
See the attached files.
I hope this was somewhat understandable. Does anybody know what causes this difference? testphotos.zip (1.29 MB)
Yes something goes definitely wrong during rotate.
I just tested it with your pics and some random jpegs. Some of them have clearly loss some don't....
By the way it's not only loss of quality but the aspects ratio is somehow messed up...Do you notice that the girls look way more slender in the rotated jpegs..not only the rotated decompressed but also the rotated original.
My eyes are aspects ratio hunters so i should know. (talking about aspect ration the dimensions/resolutions are kept the same but somehow the proportions are not right)
To perform lossless rotation the dimensions of the image must be an even multiple of the DCT block size (8) multiplied by the sampling size. The standard JPEG code defaults to a 2x2 sampling size (and Opus doesn't change this) which means an image Opus outputs would need to have even multiple dimensions of 16x16, which your test image (1632x1224) doesn't have.
The original image you provided was encoded using a 2x1 sampling size which means the dimensions only need to be a multiple of 16x8 and hence it can be losslessly rotated.
strong words jon. I'm a bit confused about the aspect ratio of the rotated pics though. Just forget about what I said. I think it has to to with my monitor settings.
I've got a widescreen monitor and I think as a result 90/180 degree rotations look like they distort the image when they really don't. I had to measure the image size with a ruler to convince myself I was imagining it. I guess it's an optical illusion from being used to 4:3 screens for so many years or something.
It can also confuse the brain that the window titlebar, menu, toolbar, etc. all add space above/below the image and never left/right of it. That space is still in the same dimension after the image is rotated, adding to the weird feeling.
Wow, thanks! I never really knew what the importance of sampling size was, but this makes sense.
It's weird that 2x2 is the default sampling size, because all of the digital camera's that I checked, use 2x1 sampling size...
Would it be possible somehow to specify the sampling size in the image converter (maybe a feature request for a next version), or even set it automatically based on if the image dimensions are a multitude of 8 or 16?
Yeah, that is why you should always look at pictures full-screen, and maybe even turning on the frame might help.
Also, are you sure that you have a 1:1 pixel aspect ratio resolution? For example my display settings can be set to 1280x720, 1280x768, 1280x800, 1280x960 and 1280x1024. Only one of these can produce a 1:1 pixel on a given screen.
It's kind of an esoteric option to add but I don't have any real objection to the idea. We could even just set the default to 2x1 and leave it at that - to be honest I have no idea what difference it would make to the quality or file size.
Interesting, thanks for that - it does make it a lot clearer.
It seems like it would make sense to simply add adjustable sub-sampling as an option along with the quality setting (which according to that article controls the "quantization table"). Alternatively, we could map both options into the one "quality" field which would then control both settings (e.g. 0->90 would map to 0->100 at 2x2 and then 91->100 would map to 91->100 at 1x1, or something like that). I wonder if this is what Photoshop does as I don't remember seeing a sample size option in that, and yet at the higher quality settings it can definitely produce better quality images than Opus can.
Yeah, that is why you should always look at pictures full-screen, and maybe even turning on the frame might help.
Also, are you sure that you have a 1:1 pixel aspect ratio resolution? For example my display settings can be set to 1280x720, 1280x768, 1280x800, 1280x960 and 1280x1024. Only one of these can produce a 1:1 pixel on a given screen.[/quote]
I think that's it. It can't be an optical illusion. I'm pretty sure I see everthing stretched out in rotated images. Your monitor needs to have 1:1 pixel mapping and you have to set it on optimum resolution. For example if your monitor is 19:10 16:10 the correct res. would be 1900x1200. If you set it on 1600x1200 you would have an incorrect resolution for a 16:10 monitor
If you have a 16:9 monitor the correct 1:1 resolution would be for example 1920 x 1080.
I have a 16:10 monitor and I just want it to test this but for some stupid reason windows 7 can't set it to 1900x1200 (I read more complaints about this on the net). It only shows 1920x1080 res. and that way I get a stretched out screen. I hope that's fixed in RTM.
[quote="OpelOpus"]For example if your monitor is 19:10 the correct res. would be 1900x1200. If you set it on 1600x1200 you would have an incorrect resolution for a 16:10 monitor
If you have a 16:9 monitor the correct 1:1 resolution would be for example 1920 x 1080.
I have a 16:10 monitor and I just want it to test this but for some stupid reason windows 7 can't set it to 1900x1200 (I read more complaints about this on the net). It only shows 1920x1080 res. and that way I get a stretched out screen. I hope that's fixed in RTM.[/quote]
You have a few errors there. Where you mentioned a 19:10 monitor, I think you meant a 16:10 monitor. But also a 16:10 would not need 1900x1200, but 1920x1200...
You are right about 1920x1080; it is really a 16:9 resolution. On a 16:10 monitor everything will be 11% too wide.
(How I hate it when people can't see an image has the wrong aspect ratio... So many TV channels here that either stretch or compress widescreen content to fit in a 4:3 frame, and the other way around! Sickening.... )
I agree. Years ago when widerscreen tv's were introduced and began to be widely used people weren't even realizing the tv was stretching out the screen. All they had to do is to set the tv on smart zoom to get the right aspects ratio, but a lot of them didn't even see the difference..lol..
I also don't understand why there are still 16:10 monitors made. I think that 16:9 is even still not standard. I am pro standardizing but that's difficult. Philips has just introduced 21:9. It won't be long 21:9 monitors are introduced as well and than we have another standard. photographers and wallpaper makers have even more work to do .
LOL... yeah! And then I am here at home working with a... 5:4 monitor! Yet another aspect ratio...
And to complicate things for wallpaper makers, at work I'm using a dual-monitor setup of one 16:9 monitor in landscape and one 16:10 monitor in portrait next to it. With lots of copy/pasting and clone-brushing I managed to edit some nice wallpapers so that they also look good on my setup