mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-02 19:03:24 +03:00
commit
6461dd63b3
BIN
Tests/images/black_and_white.ico
Normal file
BIN
Tests/images/black_and_white.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 198 B |
|
@ -18,6 +18,12 @@ def test_sanity():
|
||||||
assert im.get_format_mimetype() == "image/x-icon"
|
assert im.get_format_mimetype() == "image/x-icon"
|
||||||
|
|
||||||
|
|
||||||
|
def test_black_and_white():
|
||||||
|
with Image.open("Tests/images/black_and_white.ico") as im:
|
||||||
|
assert im.mode == "RGBA"
|
||||||
|
assert im.size == (16, 16)
|
||||||
|
|
||||||
|
|
||||||
def test_invalid_file():
|
def test_invalid_file():
|
||||||
with open("Tests/images/flower.jpg", "rb") as fp:
|
with open("Tests/images/flower.jpg", "rb") as fp:
|
||||||
with pytest.raises(SyntaxError):
|
with pytest.raises(SyntaxError):
|
||||||
|
|
|
@ -190,13 +190,7 @@ class IcoFile:
|
||||||
im.tile[0] = d, (0, 0) + im.size, o, a
|
im.tile[0] = d, (0, 0) + im.size, o, a
|
||||||
|
|
||||||
# figure out where AND mask image starts
|
# figure out where AND mask image starts
|
||||||
mode = a[0]
|
bpp = header["bpp"]
|
||||||
bpp = 8
|
|
||||||
for k, v in BmpImagePlugin.BIT2MODE.items():
|
|
||||||
if mode == v[1]:
|
|
||||||
bpp = k
|
|
||||||
break
|
|
||||||
|
|
||||||
if 32 == bpp:
|
if 32 == bpp:
|
||||||
# 32-bit color depth icon image allows semitransparent areas
|
# 32-bit color depth icon image allows semitransparent areas
|
||||||
# PIL's DIB format ignores transparency bits, recover them.
|
# PIL's DIB format ignores transparency bits, recover them.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user