-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IImage does not take into account photo Orientation, causing IImage height and width to get mixed up #23391
Comments
Hi I'm an AI powered bot that finds similar issues based off the issue title. Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you! Closed similar issues:
|
Could you provide us with a sample project so we can investigate it further? Looking forward to your reply! |
Hi @jonmdev. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
This issue has been automatically marked as stale because it has been marked as requiring author feedback to reproduce the issue but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate. |
Description
When you take cell phone picture, the phone will typically store the orientation of the phone inside the metadata. This instructs systems whether it should be displayed tall or wide.
In Maui, if you take a photo by filepicker from the file system and set it to an image like:
Then if you compare, with a cell phone photo taken in portrait, you get the Image displaying this correctly, in UI scaled units:
Width: 300.1904761904762
Height: 400
h/w: 1.3324873096446699
This shows it is displaying it taller than wide as expected for a portrait photo.
However, IImage returns the wrong info:
IIMAGE HEIGHT: 3000
IIMAGE WIDTH: 4000
IIMAGE H/WIDTH: 0.75
IImage gets it inverted. It has not taken into account the "orientation" likely of the photo so now thinks it is wider than it is tall.
This makes using IImage impractical for resizing or judging expected file dimensions or anything really. It will work fine when thereis no orientation data (eg. a phone screencap) but a real photo causes inversion of height and width parameters.
Can IImage be fixed or is there any suggestion to make it work? How is Image taking into account the orientation data? Do we have any way to read the Orientation EXIF so we can correct for it ourselves with IImage?
Orientation is discussed here somewhat:
https://stackoverflow.com/questions/9371273/how-can-i-display-the-orientation-of-a-jpeg-file
I see it claimed that Image should be able to tell us the orientation but I don't know how as the info seems outdated:
https://www.cyotek.com/blog/handling-the-orientation-exif-tag-in-images-using-csharp
Solution
Ideally IImage should automatically read the orientation in the same way as Image/ImageSource does so that these create identical outcomes.
Otherwise some method to read it manually and correct manually would work as well.
Any suggestions? Or is IImage just not useful and should be abandoned then?
Steps to Reproduce
Link to public reproduction project repository
I can post if it helps
Version with bug
8.0.61 SR6.1
Is this a regression from previous behavior?
No, this is something new
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: