-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 - Exporting portrait JPG photos on Android rotates them #6915
Comments
Maui Graphics is its own repo: https://github.com/dotnet/Microsoft.Maui.Graphics And I think your issue has to do with the platform itself, so https://github.com/xamarin/xamarin-android @jonathanpeppers Is this something that could be addressed here or should it be moved to the other repos? |
I don't see how the above would be a problem in xamarin-android at all. If you call the Android APIs, and they give this result -- the same would happen in Java or Kotlin. Do you get the same result in an Android Studio project? I don't think there is anything for us to fix here. You could file an issue on Maui.Graphics if one of their APIs is not working as expected. |
I have never used Android Studio or programmed a mobile app in Java or Kotlin. I will transfer this to Maui.Graphics then. |
@janseris His point is that this is something you can replicate with an Android app written in Java using the regular tooling. It's not a bug in the Xamarin.Android binding, nor is it something MAUI introduced. If you called those APIs from Java, you would (most likely) get the same result. |
Description
Every photo which is taken on portrait, is exported using Image.AsBytes() as landscape -> rotated counter-clockwise 90 degrees (rotate to the left).
Sample poject: MauiApp2 rotated portrait JPGs.zip
Btw.: I am experiencing the same when exporting using Android.Graphics.Bitmap in Xamarin.
From this thread, it seems like the issue is that when a Bitmap is created, the Exif info is lost and it must be passed around to keep the original rotation.
https://stackoverflow.com/questions/66437183/xamarin-android-cant-read-exif-data-from-the-rotated-image-to-check-whether-the
Edit: Confirmed - all EXIF data is lost when exporting a JPG image using MAUI Graphics or Android.Graphics on Android. No property is preserved (datetime, device info, gps coordinates, rotation, ...). Everything is cut.
Test project for confirmation of this:
MauiApp2 EXIF properties disappearing demonstration.zip
Steps to Reproduce
export IImage as bytes
Version with bug
Release Candidate 2 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android, I was not able test on other platforms
Affected platform versions
Android 11 (API 30)
Did you find any workaround?
No because there is no API to detect image orientation/rotation or to rotate the image
Relevant log output
No response
The text was updated successfully, but these errors were encountered: