Skip to content

fix: handle interlaced PNG with indexed transparency - #1673

Merged
blikblum merged 3 commits into
foliojs:masterfrom
exoego:fix-interlaced-png
Jan 26, 2026
Merged

blikblum merged 3 commits into
foliojs:masterfrom
exoego:fix-interlaced-png

Conversation

@exoego

@exoego exoego commented Jan 25, 2026 •

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

The 1st commit 99a0300 shows the broken rendering, which is fixed by the 2nd commit

before after
image image

Checklist:

  • Unit Tests
  • Documentation
  • Update CHANGELOG.md
  • Ready to be merged

issue foliojs#414 snapshot shows corrupted rendering due to bug in interlaced PNG handling. This will be fixed in the next commit.
For interlaced PNG images with indexed transparency (tRNS chunk), the decoded pixel data was not being re-encoded after deinterlacing.

This caused corrupted rendering as the original interlaced data was used instead.

The fix re-encodes the deinterlaced pixel data when processing interlaced images in loadIndexedAlphaChannel().
@blikblum
blikblum merged commit b27f9f2 into foliojs:master Jan 26, 2026
3 checks passed
@exoego
exoego deleted the fix-interlaced-png branch January 26, 2026 02:40
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.

Some PNG files fail to load

2 participants