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 encoder ignores upper 16-bits of width and height values #274

Open
DEF7 opened this issue Apr 5, 2023 · 1 comment
Open

PNG encoder ignores upper 16-bits of width and height values #274

DEF7 opened this issue Apr 5, 2023 · 1 comment

Comments

@DEF7
Copy link

DEF7 commented Apr 5, 2023

This means that PNG images generated using this code can only have dimensions that are less than 2^16.

pnghdr[18] = (mz_uint8)(w >> 8);

The PNG file format specification includes 32-bits for the width and height values, each, in the header. This implementation only uses the lowest 16-bits of the width and height values passed into the function and leaves the upper two bytes for them in the header initialized to zero.

It can easily be modified to include the entire width and height values (though they are signed ints when passed into the function) but I just thought it was worth pointing out for anyone else who is trying to output huge PNG files with this encoder. :)

@uroni
Copy link
Collaborator

uroni commented Apr 12, 2023

Could you create a PR to fix this? Looks easy to do (at least for 8 more bits).

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