Пример #1
0
 def test_paletted_image_not_transparent(self):
     img = new('P', (256, 256))
     assert img_has_transparency(img) == 0
Пример #2
0
 def test_paletted_image_transparent(self):
     img = new("P", (256, 256), 0)
     img.save("test1.png", "PNG", transparency="\x00")
     img = iopen("test1.png", "r")
     assert img_has_transparency(img)
Пример #3
0
 def test_partially_transparent(self):
     img = new("RGBA", (256, 256))
     draw = ImageDraw.Draw(img)
     draw.ellipse((96, 96, 160, 160), fill=(255, 0, 0))
     assert img_has_transparency(img) > 0
Пример #4
0
 def test_fully_transparent(self):
     img = new('RGBA', (256, 256))
     assert img_has_transparency(img) == -1
Пример #5
0
 def test_not_transparent(self):
     img = new("RGB", (256, 256), "red")
     assert img_has_transparency(img) == 0