How to detect if a PNG image has transparent alpha channel or not using PIL?
img = Image.open(\'example.png\', \'r\')
has_alpha = img.mode == \'RGBA\'
The img.info is about the image as a whole -- the alpha-value in an RGBA image is per-pixel, so of course it won't be in img.info. The getpixel method of the image object, given a coordinate as argument, returns a tuple with the values of the (four, in this case) bands for that pixel -- the tuple's last value will then be A, the alpha value.