Drew Lederman
Drew Lederman

Reputation: 61

SkiaSharp and Xamarin.Forms - unable to decode png

When using the following code in a PCL, I get an ArgumentNullException for parameter name codec.

using (var stream = new SKFileStream("image.png"))
using (var bitmap = SKBitmap.Decode(stream)) { 
    ...
}

The exception is thrown in SKBitmap.Decode. I can verify that the image is a valid PNG file and that the stream's length is greater than 0.

Do I need to install codecs separately or something? I don't see anything about it in the samples.

Upvotes: 2

Views: 1031

Answers (1)

Drew Lederman
Drew Lederman

Reputation: 61

By disabling PNG optimization (pngcrush) under iOS Build settings, I was able to resolve the issue.

Upvotes: 1

Related Questions