I wrote 2 commands to rotate images CW or CCW by 90° upon each click of the button. The rotation is done only by adjusting the EXIF rotation flag, as I want lossless rotation on my JPEG files.
The commands I wrote are: SetAttr META orientation:+90 and SetAttr META orientation:-90, respectively. The thumbnail preview, when I've set my view to "Thumbnails", does odd behavior when I run the command on a JPEG image file. Sometimes it appears to rotate correctly and, if I view the image in the Opus previewer, it appears correct. However, if I open the image in another application that reads EXIF properly, the image will be flipped by 180°. Further, if the EXIF rotation information is non-zero on an image, then the 2 commands do various things with respect to the thumbnail view vs. the "correct" rotation. Similarly, if I run either command twice, the rotation in the lister can rotate one way and back again, even though I ran the same command. (This also seems to depend on what the orientation is when I start the command.)
Finally, as soon as I hit F5 in Opus to refresh the folder, the thumbnail now will show the "correct" rotation, as I'd see it in another application.
So, a few questions: [ul]1) What's going on? Am I missing something here or is this a bug?[/ul][ul]2) The help file says "-90" is a CCW rotation, but it appears that that actually makes it a CW rotation to other programs at certain starting orientations and CCW at others...[/ul][ul]3) Is there a better way to do what I'm trying to do, which is get lossless rotation information on a group of (or single) files? (I generally like EXIF info, but am happy to try something else within Opus if it's built-in and easy.)[/ul]
I don't think so -- I've never heard of a JPEG having that capability. My camera creates a separate .thm file for the thumbnail (which is just a very small JPEG).
But how can I check?
Do you know that the other program respects the EXIF rotation flag? Many don't. (Some also do but not for thumbnails.)
JPEGs can indeed have embedded thumbnails. You can check them using something like ExifTool. (It's a command-line tool; I don't know if there's a good GUI tool for doing similar.)
By the way, Opus can do lossless rotation of the actual JPEG image in a lot of cases. Provided the JPEG meets certain common requirements, the image data can be rotated losslessly and Opus will do that automatically where possible. A quick way to check is to make a copy of your image, then rotate it 90 degrees four times, then another four times, and see if the file size remains identical.
I had the impression that the thread opener, you Tocard, is not aware of what he's actually doing, when "rotating" images by setting metadata.. ?!
If I'm right, I'd just like to add, that "SetAttr META orientation:-90" changes orientation information in the image metadata only, it does not rotate an image. If you want your images to be correctly rotated in any 3rd party application, the way to go is by using the real lossless jpg rotation, Leo already mentioned. You can rotate lossless by exif orientation automatically with DO. DO afterwards resets the "META orientation" to zero. That's the only way of rotating lossless, having a correct image orientation (in every app) and not to forget, having correctly rotated thumbnails as well.
Thank you, tbone. I am aware that changing the Meta data does not actually change the bits in the image file. Until Leo mentioned the DO can rotate a JPEG losslessly, one of the reasons I wanted to only edit the Meta data was to preserve the original image.
I have not had a chance to try DO's lossless rotation yet. However, my original question is more pointing out what appeared to me to be a bug in DO. While I've not been able to spend the time to follow Leo's instructions with ExifTool, I am still under the impression that something is amiss either with DO or the way the orientation flag is being handled.
If you give us a couple of sample JPG files and tell us which actions to do to recreate and then see the problem, we can take a look and see if it's Opus or the other program that seems to be at fault.