Skip to content

Bug in .NET 6.0 which does not occur in .NET 5.0 when saving and loading png #1765

@synercoder

Description

@synercoder

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am running the latest version of ImageSharp
  • I have verified if the problem exist in both DEBUG and RELEASE mode
  • I have searched open and closed issues to ensure it has not already been reported

Description

I use a library to render PDF pages to image data. This data is in BGRA format. I then use Image.LoadPixelData<Bgra32>(bytes, width, height) to load the data, and then use the data.

In my unit test for this library I load the Bgra32 data after rendering, then save as PNG. Later on I open that file/stream again using Image.Load. It then throws an exception: SixLabors.ImageSharp.ImageFormatException : Bad method for ZLIB header: cmf=32.

Steps to Reproduce

I have saved the raw bgra data into a file, and made a minimal bug sample. The test run on GitHub actions can be found here: https://github.com/synercoder/ImageSharpNet6Bug/runs/3675201091?check_suite_focus=true

As can the minimal sample test: https://github.com/synercoder/ImageSharpNet6Bug/blob/main/ImageSharpBugTests/BugTests.cs

System Configuration

  • ImageSharp version: 1.0.3
  • Environment (Operating system, version and so on): Windows 10, bug also reproduced in GitHub Actions on Windows-latest
  • .NET Framework version: My pc & Github actions: 6.0.100-rc.1.21458.32
  • Additional information: Works in .NET 5.0 & images used in the raw file are from Pexels.com under the royalty-free license if that was any worry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions