Skip to content

Normalize to RGBA when decoding indexed images #11

Open
@mourner

Description

@mourner

@targos Thanks for such a nice library! Just sharing something I found unexpected (after trying to switch to fast-png from pngjs):

  • If you want to manipulate pixel data after decoding an indexed image, you have to normalize it into RGBA (from palette + indices) manually. This is 1) not documented, 2) inconvenient. Maybe worth adding a normalize option to decode?
  • The format of the palette property is [[r, g, b], [r, g, b]], which is inefficient — allocating more memory than necessary. Since we know the number of colors before hand, ideally this would be returned in flat typed form — Uint8ClampedArray([r, g, b, r, g, b, ...]).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions