Remove transparency/alpha from any image using PIL
This can be done by checking if the image is transparent def remove_transparency(im, bg_colour=(255, 255, 255)): # Only process if image has transparency (http://stackoverflow.com/a/1963146) if im.mode in (‘RGBA’, ‘LA’) or (im.mode == ‘P’ and ‘transparency’ in im.info): # Need to convert to RGBA if LA format due to a bug in PIL (http://stackoverflow.com/a/1963146) alpha = … Read more