We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 10c6745 + b90fe80 commit 7cb074fCopy full SHA for 7cb074f
Tests/test_file_gd.py
@@ -1,5 +1,7 @@
1
from __future__ import annotations
2
3
+from io import BytesIO
4
+
5
import pytest
6
7
from PIL import GdImageFile, UnidentifiedImageError
@@ -16,6 +18,14 @@ def test_sanity() -> None:
16
18
assert_image_similar_tofile(im.convert("RGB"), "Tests/images/hopper.jpg", 14)
17
19
20
21
+def test_transparency() -> None:
22
+ with open(TEST_GD_FILE, "rb") as fp:
23
+ data = bytearray(fp.read())
24
+ data[7:11] = b"\x00\x00\x00\x05"
25
+ with GdImageFile.open(BytesIO(data)) as im:
26
+ assert im.info["transparency"] == 5
27
28
29
def test_bad_mode() -> None:
30
with pytest.raises(ValueError):
31
GdImageFile.open(TEST_GD_FILE, "bad mode")
0 commit comments