-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Description
What did you do?
We are using PIL for reading PPM images of 1280x1024 or 1920x1080 pixels in RGB 24 bits with maxval of 255 in the header.
What did you expect to happen?
We expect the PPM to open correctly.
What actually happened?
The opening of PPM images failed due to a maxval error "Channel value too large for this mode"
What are your OS, Python and Pillow versions?
- OS: Windows 10
- Python: 3.9
- Pillow: 9.4.0
When I first try to load my PPM, PIL return the channel value too large error with the value of 20458 with a maxval of 255. Then I searched in my PPM this value and there is no data higher than 255.
After investigated the issue, I saw that the concatenation of the half_block and the next block block give this:
-> end of previus block: ... 204 ]
-> half_block + block: [20458 ...
-> expected: [204 58 ...
I fixed the issue locally by changing line 239:
if half_token:
block = half_token + block # stitch half_token to new blockBy
if half_token:
block = half_token + b' ' + block # stitch half_token to new block
half_token = FalseMetadata
Metadata
Assignees
Labels
No labels