-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Added support for reading BMP images with RLE4 compression #6674
Conversation
for more information, see https://pre-commit.ci
assert_image_similar_tofile(im, "Tests/images/hopper_4bit.bmp", 12) | ||
|
||
with Image.open("Tests/images/bmp/g/pal4rle.bmp") as im: | ||
assert_image_similar_tofile(im, "Tests/images/bmp/g/pal4.bmp", 12) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any significant difference between hopper_rle4.bmp and pal4rle.bmp?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed hopper_rle4.bmp, since the other test image seems sufficient.
I've created npjg#1 with a documentation correction, and to simplify the code by combining the two BMP RLE decoders into one. |
src/PIL/BmpImagePlugin.py
Outdated
x = len(data) % self.state.xsize | ||
else: | ||
# absolute mode (2 pixels per byte) | ||
total_bytes_to_read = byte[0] // 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this "2" comment mean? If it means this value is always 2, that won't work, because this is already checked for on line 367.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a comment. Commenting in Python is #. This is floor division.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, right. There's even a real comment right above that and I didn't notice...
I was gone for a few days. Looks good, thanks for merging! |
It's an old format, but I still see it a good bit when examining old software.