JPEG orientation
Dave Higton (1515) 3526 posts |
I’ve received a batch of JPEG files, some of which display the right way up when viewed on Ubuntu’s filer, but display 90 degrees out on RISC OS using Jcut, SwiftJPEG and PrivateEye. What should be the top of the image appears at the left side. If I use Jcut to rotate them 90 degrees clockwise, the RISC OS apps see them correctly, but then Ubuntu shows them with the top at the right side. First question is how and why they can be seen differently by different apps. Has anyone else observed this? It’s not the first time I’ve seen it, but it has suddenly become important to me because I need to submit the photos to a web site, and I want to be sure that they will be seen consistently. Presumably some were taken with the camera body horizontal and some with it vertical, but I still don’t understand why they should be seen inconsistently. |
Chris Johnson (125) 825 posts |
This is due to the jpeg having an orientation flag in its EXIF info. As far as I know, all RISC OS software ignores this flag when showing the image, but just shows it landscape as in camera. Other platform viewers check this flag before displaying the image. When you rotated the image, the orientation flag was not reset, so the linux etc viewers still rotate the image. If you use my TranJPEG app to auto rotate the images, there is a user option to reset the orientation flag. |
Jeffrey Lee (213) 6048 posts |
They can contain metadata which indicates the orientation they should be displayed at. Does SpriteExtend display them correctly? Might be a good thing to go on our todo list if the OS can’t display them properly. |
Chris Johnson (125) 825 posts |
One thing on my ’wouldn’t it be nice to do’ list is to include the corresponding rotation of any thumbnail in the exif header. Whether that ever gets done is another matter, of course. |
Dave Higton (1515) 3526 posts |
There’s an option “Write back orientation”, if that’s what you mean. But I can’t understand how to use it. I thought that “AUTO rotate” in combination with “Write back orientation” might do it, but the app doesn’t do anything. So far I haven’t found any combination of the controls that causes the images to be displayed consistently. I did once end up with Ubuntu and RISC OS apparently displaying them 180 degrees apart, but I’m not sure I believe what I saw. I’d appreciate an explanation that I can understand, of how to set the settings to do what I want. |
Chris Johnson (125) 825 posts |
What images are you starting from? If you start from the original images and use TranJPEG on them with ‘auto-rotate’ set, and orientation write back set, then you should find the images (or those that were taken in portrait mode) in correct portrait mode, and the flag should have been reset to normal. All systems should them display them as portrait images. However, if you have used images that have already been rotated in RISC OS (but not by TranJPEG), then the orientation flag will not correspond to the actual orientation. TranJPEG will rotate them again. Everyone will get confused. Or else TranJPEG is broken 8( |
Dave Higton (1515) 3526 posts |
The images in question were taken, and subsequently processed, by someone else. I know that the OS used is Ubuntu 17, but, more importantly, I don’t know whether the processing was done by a native application or by a web site. I’m simply reacting to the consequences. I can get the original images, and I can process them again myself, but (apart from possibly upsetting the lady who did all the work) it doesn’t address the issue of inconsistency that we have found. An important clue is that stripping all the EXIF info (using TranJPEG) results in consistent display, but I don’t see why I should need to do that. Something you might like to look again at is that EXIF info is controlled in three places in TranJPEG: an overall “Strip EXIF data” in the Control window, the “Copy exif data” group in the Settings window, and the “Write back orientation” switch (which doesn’t mention EXIF data) in the “Auto-rotate options” group. It’s a bit bitty. The fact that stripping EXIF data fixes the issue, makes me wonder what the precedence of those three EXIF control settings is. |
Chris Johnson (125) 825 posts |
Dave – maybe you could contact me privately – my email is in the help file for TranJPEG. Maybe we could arrange for you to send me two or three of the images to have a look at the actual exif data in them. |
Chris Hall (132) 3554 posts |
They can contain metadata which indicates the orientation they should be displayed at. That explains why PhotoDesk takes ages to rotate a JPEG by 90° whereas Windows can do it in a fraction of a second. |