public static SKImage FromEncodedData(string filename)
{
if (filename == null)
{
throw new ArgumentNullException(nameof(filename));
}
using (var stream = SKBitmap.OpenStream(filename))
using (var codec = SKCodec.Create(stream))
using (var bitmap = SKBitmap.Decode(codec, codec.Info)) {
if (bitmap == null)
{
return(null);
}
return(FromBitmap(bitmap));
}
}