Skip to content

Sometimes PNG files cannot be decoded #1981

@inforithmics

Description

@inforithmics

Description

Skia Sharp 2.88.0-preview.232 does not display a png fully - in 2.88.0-preview.209 it works

Code

private void OnPaintSurface(object sender, SKPaintSurfaceEventArgs e)
		{
			// the the canvas and properties
			var canvas = e.Surface.Canvas;

			// make sure the canvas is blank
			canvas.Clear(SKColors.White);

			using var stream = File.Open(@"osm-liberty.png", FileMode.Open, FileAccess.Read, FileShare.Read);
			var data = SKData.Create(stream);
			var image = SKImage.FromEncodedData(data);

			// draw image
			canvas.DrawImage(image, new SKRect(0, 0, image.Width, image.Height));
		}

This should be displayed

image

But this is displayed

image

Basic Information

  • Version with issue: 2.88.0-preview.232
  • Last known good version: 2.88.0-preview.209
  • IDE: Visual Studio 2022 17.1.2
  • Platform Target Frameworks: .Net Framework 4.8
    • Windows Classic: Windows 11

Reproduction Link

WPF.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions