Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PNG out-of-range palette indices #75

Open
randy408 opened this issue Feb 22, 2022 · 1 comment
Open

PNG out-of-range palette indices #75

randy408 opened this issue Feb 22, 2022 · 1 comment

Comments

@randy408
Copy link

I haven't looked too much into it but my initial tests with spngt on the two images at w3c/PNG-spec#96 appear to not decode with wuffs, probably because the out-of-range values are handled as an error, might want to change it to match libpng's defaults.

@nigeltao
Copy link
Collaborator

appear to not decode with wuffs

Can you share the code that leads to this conclusion?

// Set the remaining palette entries to opaque black.
while i < 256 {
this.src_palette[(4 * i) + 0] = 0x00
this.src_palette[(4 * i) + 1] = 0x00
this.src_palette[(4 * i) + 2] = 0x00
this.src_palette[(4 * i) + 3] = 0xFF
i += 1
} endwhile
explicitly fills out-of-range palette entries to opaque black.

After running ./build-example.sh example/imageviewer from the Wuffs directory, the gen/bin/example-imageviewer X11 GUI program (which exercises Wuffs' PNG decoder) seems to agree with the w3c/PNG-spec#96 original post: gray border, opaque black top and (opaque blue | transparent) bottom. Use the comma key, in gen/bin/example-imageviewer, to cycle the background color (which shows through transparent pixels).

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

No branches or pull requests

2 participants