Description
To check whether the image is rotated or not by reading the EXIF meta data based on the orientation rotate then create the new bitmap and set to ImageView control.
[C#]
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
ImageView image = new ImageView(this);
var bitmap = BitmapFactory.DecodeResource(Resources, Resource.Drawable.test);
ExifInterface originalMetadata;
using (var stream = new MemoryStream())
{
bitmap.Compress(Bitmap.CompressFormat.Jpeg, 0, stream);
originalMetadata = new ExifInterface(stream);
}
int orientation = GetRotation(originalMetadata);
Matrix matrix = new Matrix();
if (orientation != 0)
{
matrix.PreRotate(orientation);
bitmap = Bitmap.CreateBitmap(bitmap, 0, 0, bitmap.Width, bitmap.Height, matrix, true);
}
image.SetImageBitmap(bitmap);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.activity_main);
}
Expected Behavior
To read the rotated image ExifData to get the orientation. Based on the orientation rotate then create the new bitmap and set to ImageView control.
Actual Behavior
Getting the ExifData orientation value as 0.
Basic Information
Tested device are Huawei PRA, Infinix Pro
Environment
Visual Studio 2019
Screenshots
[![enter image description here][1]][1]

Sample Link
ImageDemo.zip
Uploading Image_CameraAndGallery.zip…
Description
To check whether the image is rotated or not by reading the EXIF meta data based on the orientation rotate then create the new bitmap and set to ImageView control.
[C#]
Expected Behavior
To read the rotated image ExifData to get the orientation. Based on the orientation rotate then create the new bitmap and set to ImageView control.
Actual Behavior
Getting the ExifData orientation value as 0.
Basic Information
Tested device are Huawei PRA, Infinix Pro
Environment
Visual Studio 2019
Screenshots
[![enter image description here][1]][1]

Sample Link
ImageDemo.zip
Uploading Image_CameraAndGallery.zip…