Skip to content

GetPngMetadata does not set HasTransparency correctly for palette-based PNGs #2209

@Seishiin

Description

@Seishiin

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

ImageSharp version

2.1.3

Other ImageSharp packages and versions

None

Environment (Operating system, version and so on)

Windows 10 21H1

.NET Framework version

.NET6

Description

When calling GetPngMetadata on a palette-based PNG with transparency HasTransparency is false when it should be true.

Steps to Reproduce

var imageInfo = Image.Identify("sample.png");
var metadata = imageInfo.Metadata.GetPngMetadata();
var colorType = metadata.ColorType; // PngColorType.Palette
var transparency = metadata.HasTransparency; // should be true but is false

Images

sample.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions