I’m currently facing a problem with pictures having an EXIF tag for the Orientation (rotated, etc.).
On Mac, a such picture always ignore the EXIF tag. Being it seen as preview in Finder or opened with Preview and consistently even opening it in Xojo with Picture.Open.
On Windows the Picture.Open always honour the EXIF tag and the opened picture is rotated, etc. depending on the EXIF setting. Still on Windows Explorer or opening it with Paint it ignores the EXIF tag as it happens on Mac.
Now, I believe Picture.Open is not consistent on Windows. Not with the Windows behaviour and nor with the Mac counterpart.
I’m going to open a feedback request for this, but I’d first like to hear some counter argument if any, on why this could be the correct behaviour.
I believe Finder and Preview opted out with newer macOS due to massive contestation from users rotating pictures in Preview and then after uploading somewhere not supporting this feature the images appeared unrotated.
@Massimo Valle: I recently needed to look into rotation of images, too. Finder, Preview and Xojo rotate the images automatically. That was on High Sierra and Mojave.
[quote=443830:@Beatrix Willius]As usual the MBS plugin helps (for macOS):
[code]dim image as new GMImageMBS(PreviewPic)
image.autoOrient
PreviewPic = image.CopyPicture(0, 0, image.columns, image.rows)
dim PreviewPicMask as Picture = image.CopyPictureMask(0, 0, image.columns, image.rows)
PreviewPic.Mask.Graphics.DrawPicture PreviewPicMask, 0, 0[/code][/quote]
Thanks Beatrix, however my current problem is not how to apply the orientation, I can do that in cross platform way.
My problem is about Picture.Open behaving differently on Mac and Windows. On Mac the EXIF tag is ignored, on Windows is not.
I imagine Xojo will be inheriting the default behaviour of the underlying OS APIs.
You could replace your use of Picture.Open with the relevant MBS JPEG, PNG and TIFF plugins. This would always give you a picture that did not have the EXIF rotation applied.
[quote=443833:@Kevin Gale]I imagine Xojo will be inheriting the default behaviour of the underlying OS APIs.
You could replace your use of Picture.Open with the relevant MBS JPEG, PNG and TIFF plugins. This would always give you a picture that did not have the EXIF rotation applied.[/quote]
The problem with using MBS is I don’t know which kind of picture is. With Picture.Open I can get any supported picture file, including a PDF on Mac.
You can easily check what type of file it is by reading the first few bytes of the file and testing the values. If it matches the JPEG, PNG or TIFF signatures use the MBS plugins otherwise fallback to Picture.Open for everything else.
Sometimes in the past, on macOS, things were as you wrote.
If you want to make real test, use a reference image, not image from unknow (unreliable) source. I do not know that application source (time of creation / OS used originally) The author may still use a 10.2 MacOS where this was a problem
(this happens).
If you have a recent numeric camera (or a smart phone) you can create your own reference file (whith hopes).
[quote=443838:@Massimo Valle]This is what I see for image 2
which is clearly shown wrongly[/quote]
Perhaps I miss something here but: Why is it wrong?
macOS Preview does honour the EXIF tag and the image is shown properly as requested from this tag. In fact all my test images with EXIF tag 1-8 are shown visually identical and not rotated, mirrored etc. as the real bitmap in the image.
I use currently macOS 10.14 but I remember the same from previous macOS versions.
[quote=443842:@Thomas Eckert]Perhaps I miss something here but: Why is it wrong?
macOS Preview does honour the EXIF tag and the image is shown properly as requested from this tag. In fact all my test images with EXIF tag 1-8 are shown visually identical and not rotated, mirrored etc. as the real bitmap in the image.
I use currently macOS 10.14 but I remember the same from previous macOS versions.[/quote]
This is the misunderstanding I believe: Preview do not show the image flipped as it should.
Imagine this:
A random image editor is requested to rotate a picture. Instead of physically rotate it, it just write an EXIF tag to tell the image has to be shown rotated. This non-destructive editing.
Now I open the image in Preview and it’s shown unrotated, but if I go checking the informations about it, it says it’s rotated. And this is just a hint, like “try to figure out yourself the image is rotated”.
IMHO, this is wrong, especially if you consider the Orientation is not the only EXIF tag you can have. Can you figure out how your picture can loo just reading all the EXIF tags?
But as I said on my original post was about the Xojo behaviour on opening a Picture. On Windows the EXIF tags are honoured and the picture I get is rotated, flipped, etc. On macOS this doesn’t happen.
I don’t want to argue, which method is correct or not, I just argue this is not consistent across platform and I’d like to know if this is something Xojo can fix or this is the OS provided behaviour and Xojo just have to conform to it because is using the OS APIs.