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

Fixed reading 9 to 15-bit PGM #6107

Closed
wants to merge 2 commits into from

Conversation

radarhere
Copy link
Member

@radarhere radarhere commented Mar 2, 2022

Resolves #5403

The image from the issue is 10-bit PGM. As per http://netpbm.sourceforge.net/doc/pgm.html, this bit depth can be determined from the "maximum gray value (Maxval)" in the header (s or # maxgrey in PpmImagePlugin) of 1023 (2 ** 10 - 1).

This PR adds an unpacker for that. The test image included was created with ImageMagick using convert hopper.png -depth 10 10_bit_binary.pgm.

@radarhere radarhere changed the title Fixed reading 10-bit PGM Fixed reading 9, 10, 12 and 14-bit PGM Mar 3, 2022
@radarhere
Copy link
Member Author

As requested, I've also now added 9, 12 and 14-bit.

@radarhere radarhere changed the title Fixed reading 9, 10, 12 and 14-bit PGM Fixed reading 9 to 15-bit PGM Mar 4, 2022
@wiredfool
Copy link
Member

I feel a little bad for the prime numbered bits 11, 13, which have been sadly neglected, here and in the wild.

@radarhere
Copy link
Member Author

Closing this PR, in favour of #6119, as it doesn't just resolve PPM reading for different bit depths, but other maxval settings as well - helping even more neglected numbers!

@radarhere radarhere closed this Mar 9, 2022
@radarhere radarhere deleted the 10_bit_pgm branch March 9, 2022 11:31
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.

10 bit pgm file not read correctly
2 participants