Table of Contents

Class PngImageDecoder

Namespace
DocWright.Core.Imaging
Assembly
DocWright.Core.dll

A self-contained PNG decoder: signature, chunk walk, zlib inflate, unfiltering, palette expansion and tRNS transparency.

public static class PngImageDecoder
Inheritance
PngImageDecoder
Inherited Members

Remarks

This code was the PDF renderer's private decoder and now lives here because the imaging renderer needs the same pixels. Two decoders would drift, and the drift would show up as the PDF and the PNG of one page disagreeing about an image — which is precisely the signal Phase 17's self-consistency gate exists to detect, so it would poison its own measurement.

Scope is deliberately narrow and reports rather than guesses: 8-bit samples, non-interlaced, colour types 0/2/3/4/6. Anything else returns false with a reason.

Methods

HasSignature(byte[])

Returns true when the bytes begin with the PNG signature.

TryDecode(byte[], out DecodedRasterImage?, out string)

Decodes a PNG image.

TryDecode(byte[], long, out DecodedRasterImage?, out string)

Decodes a PNG, refusing an image whose declared dimensions pass a pixel budget.