Skip to content

Commit 7f39a21

Browse files
authored
Merge pull request #1 from radarhere/p2pa_images_conversion
Only test alpha channel values
2 parents 84da709 + b0bc74a commit 7f39a21

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Tests/test_image_convert.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -222,18 +222,18 @@ def test_p_la():
222222
assert_image_similar(alpha, comparable, 5)
223223

224224

225-
def test_p_pa():
225+
def test_p2pa_alpha():
226226
with Image.open("Tests/images/tiny.png") as im:
227227
assert im.mode == "P"
228228

229229
im_pa = im.convert("PA")
230-
assert im_pa.mode == "PA"
230+
assert im_pa.mode == "PA"
231231

232-
assert (
233-
im_pa.tobytes() == b"\x00\x00\x00\x00\x08\xff\x04\xff\x00\x00\x00\x00"
234-
b"\x06\xff\x07\xff\x00\x00\x00\x00\x02\xff\x03\xff\x00"
235-
b"\x00\x00\x00\x01\xff\x05\xff"
236-
)
232+
im_a = im_pa.getchannel("A")
233+
for x in range(4):
234+
alpha = 255 if x > 1 else 0
235+
for y in range(4):
236+
assert im_a.getpixel((x, y)) == alpha
237237

238238

239239
def test_matrix_illegal_conversion():

0 commit comments

Comments
 (0)