Skip to content

Add palette and 1-bit grayscale PNG support#102

Merged
rowland merged 1 commit intomasterfrom
add-png-color-types
May 9, 2026
Merged

Add palette and 1-bit grayscale PNG support#102
rowland merged 1 commit intomasterfrom
add-png-color-types

Conversation

@rowland
Copy link
Copy Markdown
Owner

@rowland rowland commented May 9, 2026

Summary

  • Expand PNG decoding to accept color type 3 palette images at 1/2/4/8-bit depths and normalize them into the existing PDF image path.
  • Allow low-bit grayscale PNGs, including 1-bit grayscale, and standardize decoded sample data to 8-bit output.
  • Preserve palette transparency via tRNS by keeping the soft-mask flow, and drop alpha metadata once a decoded image is fully opaque.
  • Add focused tests covering palette PNGs, palette transparency, and 1-bit grayscale PNGs with synthetic in-repo fixtures.

Testing

  • go test ./pdf
  • go test ./...
  • go build ./...
  • Smoke-tested representative external PNG assets from ~/src/re2/assets through PrintImageFile

@rowland rowland merged commit 6e4b0c3 into master May 9, 2026
2 checks passed
@rowland rowland deleted the add-png-color-types branch May 9, 2026 18:00
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.

1 participant