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

Figure out the length of palette before calling png_get_PLTE #50

Open
Drvi opened this issue Dec 28, 2021 · 0 comments
Open

Figure out the length of palette before calling png_get_PLTE #50

Drvi opened this issue Dec 28, 2021 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@Drvi
Copy link
Collaborator

Drvi commented Dec 28, 2021

Currently, when processing paletted images, we first prepare a palette color buffer of maximum size (PNG_MAX_PALETTE_LENGTH, 256), then we query the file to populate the buffer and finally we resize the buffer to match the number of the color entries in the file. As @t-bltg noted (#47 (comment)), there is a way to know the palette length before populating the buffer, in which case we could simply create the buffer of the correct size.

IIUC, to be able to get the palette length early, one has to use libpng transformation (see the comment referenced above), so we need to figure out how to do it and whether it's beneficial in terms of performance.

@Drvi Drvi added the help wanted Extra attention is needed label Dec 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant