Skip to content

feat: implement indexed PNG (color type 3) decoding support#98

Open
nnmrts wants to merge 4 commits intocross-org:mainfrom
nnmrts:feat-indexed-png
Open

feat: implement indexed PNG (color type 3) decoding support#98
nnmrts wants to merge 4 commits intocross-org:mainfrom
nnmrts:feat-indexed-png

Conversation

@nnmrts
Copy link

@nnmrts nnmrts commented Mar 10, 2026

Added

  • Indexed PNG (color type 3) decoding support:
    • PLTE palette chunk parsing for up to 256 RGB colors
    • tRNS chunk support for per-entry palette transparency
    • Sub-byte bit depths (1, 2, 4 bits per pixel) in addition to 8-bit indexed color

Changes

  • src/formats/png_base.tsunfilterAndConvert() now accepts an optional palette parameter; handles packed sub-byte scanlines and maps pixel indices to RGBA
  • src/formats/png.ts — parses PLTE/tRNS chunks and builds the RGBA palette before decoding
  • src/formats/apng.ts — same PLTE/tRNS handling for all APNG frame types
  • test/formats/png.test.ts — 7 new test cases covering 8-bit, 4-bit, 1-bit indexed color, transparency, and error conditions
  • CHANGELOG.md — updated [Unreleased] section

All 556 tests pass (deno task precommit).

Copilot AI and others added 4 commits March 10, 2026 01:08
Co-authored-by: nnmrts <20396367+nnmrts@users.noreply.github.com>
…dback

Co-authored-by: nnmrts <20396367+nnmrts@users.noreply.github.com>
feat: implement indexed PNG (color type 3) decoding support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants