def remove_transparency(im, bg_colour=(255, 255, 255)):
    if im.mode in ('RGBA', 'LA'
        ) or im.mode == 'P' and 'transparency' in im.info:
        alpha = im.convert('RGBA').split()[-1]
Remove transparency/alpha from any image using PIL