mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 10:46:16 +03:00
Fixed loading L mode RLE8 images
This commit is contained in:
parent
5fc3b6e5bb
commit
3e8a9b2165
BIN
Tests/images/hopper_rle8_greyscale.bmp
Normal file
BIN
Tests/images/hopper_rle8_greyscale.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
|
@ -134,6 +134,9 @@ def test_rle8():
|
||||||
with Image.open("Tests/images/hopper_rle8.bmp") as im:
|
with Image.open("Tests/images/hopper_rle8.bmp") as im:
|
||||||
assert_image_similar_tofile(im.convert("RGB"), "Tests/images/hopper.bmp", 12)
|
assert_image_similar_tofile(im.convert("RGB"), "Tests/images/hopper.bmp", 12)
|
||||||
|
|
||||||
|
with Image.open("Tests/images/hopper_rle8_greyscale.bmp") as im:
|
||||||
|
assert_image_equal_tofile(im, "Tests/images/bw_gradient.png")
|
||||||
|
|
||||||
# This test image has been manually hexedited
|
# This test image has been manually hexedited
|
||||||
# to have rows with too much data
|
# to have rows with too much data
|
||||||
with Image.open("Tests/images/hopper_rle8_row_overflow.bmp") as im:
|
with Image.open("Tests/images/hopper_rle8_row_overflow.bmp") as im:
|
||||||
|
|
|
@ -321,7 +321,8 @@ class BmpRleDecoder(ImageFile.PyDecoder):
|
||||||
# align to 16-bit word boundary
|
# align to 16-bit word boundary
|
||||||
if self.fd.tell() % 2 != 0:
|
if self.fd.tell() % 2 != 0:
|
||||||
self.fd.seek(1, os.SEEK_CUR)
|
self.fd.seek(1, os.SEEK_CUR)
|
||||||
self.set_as_raw(bytes(data), ("P", 0, self.args[-1]))
|
rawmode = "L" if self.mode == "L" else "P"
|
||||||
|
self.set_as_raw(bytes(data), (rawmode, 0, self.args[-1]))
|
||||||
return -1, 0
|
return -1, 0
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user