Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

MediaFile returns null on iOS

$
0
0

I am trying to fix 90 degrees rotation on iOS using the GetStreamWithImageRotatedForExternalStorage() method instead of GetStream().

The issue I have is that GetStream() works but return the image rotated, but when using GetStreamWithImageRotatedForExternalStorage() it returns an empty stream?

First I get the file using:

file = await CrossMedia.Current.PickPhotoAsync()

Then that file is passed to below method:

public static byte[] GetCropedImage(MediaFile file)
{
  using (var inputStream = new SKManagedStream(file.GetStreamWithImageRotatedForExternalStorage()))
  {
    using (var original = SKBitmap.Decode(inputStream))
    {
Here original is null?
    }
  }
}

I use the latest version of MediaPlugin 4.0.1.1 and SkiaSharp 1.60.2.

Both GetStream() and GetStreamWithImageRotatedForExternalStorage() works just fine on Android both with the image rotated correctly.

Anyone having an idea what I am doing wrong or are we talking about a bug?


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>