mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Read AND mask from end
This commit is contained in:
parent
953b57510f
commit
cbdc751628
BIN
Tests/images/hopper_mask.ico
Normal file
BIN
Tests/images/hopper_mask.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 262 B |
BIN
Tests/images/hopper_mask.png
Normal file
BIN
Tests/images/hopper_mask.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 208 B |
|
@ -18,6 +18,11 @@ def test_sanity():
|
|||
assert im.get_format_mimetype() == "image/x-icon"
|
||||
|
||||
|
||||
def test_mask():
|
||||
with Image.open("Tests/images/hopper_mask.ico") as im:
|
||||
assert_image_equal_tofile(im, "Tests/images/hopper_mask.png")
|
||||
|
||||
|
||||
def test_black_and_white():
|
||||
with Image.open("Tests/images/black_and_white.ico") as im:
|
||||
assert im.mode == "RGBA"
|
||||
|
|
|
@ -235,8 +235,8 @@ class IcoFile:
|
|||
# the total mask data is
|
||||
# padded row size * height / bits per char
|
||||
|
||||
and_mask_offset = o + int(im.size[0] * im.size[1] * (bpp / 8.0))
|
||||
total_bytes = int((w * im.size[1]) / 8)
|
||||
and_mask_offset = header["offset"] + header["size"] - total_bytes
|
||||
|
||||
self.buf.seek(and_mask_offset)
|
||||
mask_data = self.buf.read(total_bytes)
|
||||
|
|
Loading…
Reference in New Issue
Block a user