Added support for reading BMP images with RLE4 compression#6674
Added support for reading BMP images with RLE4 compression#6674radarhere merged 10 commits intopython-pillow:mainfrom
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.
Is there any significant difference between hopper_rle4.bmp and pal4rle.bmp?
There was a problem hiding this comment.
I've removed hopper_rle4.bmp, since the other test image seems sufficient.
|
I've created https://github.com/npjg/Pillow/pull/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.
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.
It's not a comment. Commenting in Python is #. This is floor division.
There was a problem hiding this comment.
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.