[BUG] SkiaSharp Gray8 decoding returns null
Description
In SkiaSharp 1.60.3 loading an 8bit png would result in a bitmap with BytesPerPixel == 1.
In 1.68.0, BytesPerPixel == 4
Apparently now we need to pass in the codec when decoding to tell Skia it is an 8 bit image. https://github.com/mono/SkiaSharp/issues/694#issuecomment-441078401
Code
// bytes = File.ReadAllBytes(....)
var stream = new MemoryStream(bytes);
var codec = SKCodec.Create(stream);
var imageInfo = new SKImageInfo(codec.Info.Width, codec.Info.Height, SKColorType.Gray8);
var bitmap = SKBitmap.Decode(codec, imageInfo);
Expected Behavior
BytesPerPixel == 1
Actual Behavior
bitmap == null
Basic Information
- Version with issue:
1.68.0 - Last known good version:
1.60.3 - IDE:
Visual Studio Code - Platform Target Frameworks:
netcoreapp3.0
Screenshots
Reproduction Link
Input image:

VS bug #770226
Thanks for reporting this, I will investigate. I also get the null result when I believe it should be working.
Same issue here. I'm using SkiaSharp 1.68.0.
Is this still an issue?
This issue still persists in version 3.119.1. Are there plans to address it in the future?