I’m trying to figure out how to get the image rotation on Android/iOS devices using .NET MAUI. I have the following code to get the Image Width and height. NOTE: I allow the user to select an image from their device. This is the <path_to_image>.
I’ve got the following code working on Android devices:
using (Stream stream = File.OpenRead(<path_to_image>))
{
image = PlatformImage.FromStream(stream);
if (image != null)
{
Int32 width = Convert.ToInt32(image.Width);
Int32 heigh = Convert.ToInt32(image.Height);
}
}
I can use this code to determine if the image is landscape or portrait. But now I need the Metadata information of the image to determine the Metadata orientation (similar to the following: Problem reading JPEG Metadata (Orientation) which only works on Windows).
Thoughts?