Skip to content

byte-codec's encodePng cannot emit an indexed-colour PNG that decodePng can read #981

Description

@Mearman

The decoder handles all five PNG colour types including palette (type 3) via PLTE lookup; the encoder covers only four, because RawImage carries no palette of its own. Small and self-contained, and the payoff is real for document work: indexed colour is substantially smaller than truecolour for the flat-colour images typical of diagrams and screenshots that end up embedded in documents.

Evidence

src/image/png-encode.ts: "RawImage's channels/alpha combination maps onto these four (never 3, palette -- this encoder never emits an indexed-colour image, since RawImage carries no palette of its own)." decodePng handles colorType === 3 via a PLTE chunk lookup in src/image/png-decode.ts.

Affected packages: byte-codec


Surfaced by a full-repository gap survey (feature/fidelity/write-support gaps), cross-checked against the existing issue history so it does not duplicate prior work.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions