Ive just had a weird support call.
A JPG image that I open into a Xojo picture object:
On Mac it presents as a tall rectangle, 2000 wide and 3000 tall.
On Windows, it opens as a picture. The width of the picture is 3000 and the height is 2000
When I .drawpicture it, it is the right way up, but due to ‘knowing’ what the height is, I lose 1000 pixels from the bottom.
Opened in Windows default image viewer, it displays as a horizontal image which is ‘rotated 90 degrees left’ and is 3000 wide and 2000 tall.
Something about the image tells Mac that it should be rotated, and the Mac gets the rotated dimenions correct.
On Windows, Xojo rotates the image but doesnt swap the dimensions.
Is there a way to stop the auto rotation, or fix the dimensions, or detect the ‘rotated’ attribute (no such property in the picture object)
Windows 7
Xojo 2015 3.1
It might be the EXIF rotation flag, are you able to share the actual image with us?
Assuming the ftp transfer doesnt change anything:
www.ursasoftware.com/rotateexample.jpg
The EXIF Orientation flag is 6
This means that 0,0 is top right corner of the image.
I guess I need to detect that and 8, and swap width and height on Windows builds.
Odd, because the image is ‘the right way up’ in a rectangle of the wrong size.
It would be useful for the framework to include orientation and allow us to be aware of it.
I understand why width and height are technically correct, but perhaps we need something like OrientedHeight
so we can properly calculate how drawing will happen.
This appears to sort it out, but I think I need to keep an eye on this during testing when I move to 64bit or a newer Xojo.
[code] dim g as new GMImageMBS(f)
orient = g.attributeValue(“EXIF:Orientation”)
if TargetWin32 then
if orient = "6" then
g.rotate 90
end if
if orient = "8" then
g.rotate -90
end if
end if
dim a_pic as picture = g.CopyPicture[/code]
I’ve experienced this issue before. The issue has been fixed in Xojo 2017r1 or probably 2016r4.1. Xojo 2016r3 still has the issue.