standardebooks / tools

The Standard Ebooks toolset for producing our ebook files.
Other
1.43k stars 127 forks source link

lint: Test and improve PNG transparency check (f-019) #746

Closed gvtulder closed 2 months ago

gvtulder commented 2 months ago

se lint doesn't recognize some types of PNG transparency. This adds small test images with different types of transparency/non-transparency, and some additional code to cover:

The test includes some transparent and some non-transparent images, where some of the non-transparent images have an unused alpha channel.

PIL.Image details per image: mode info[transparency] Transparent?
illustration-1.png L None No
illustration-2.png LA None Yes
illustration-3.png P b'\x00\x11"3DUfw\x88\x99\xaa\xbb\xcc\xdd\xee' Yes
illustration-4.png P 0 Yes
illustration-5.png RGBA None Yes
illustration-6.png RGBA None No
illustration-7.png RGB None No
illustration-8.png LA None No
acabal commented 2 months ago

Great, thanks!