PIL Convert PNG or GIF with Transparency to JPG without

Make your background RGB, not RGBA. And remove the later conversion of the background to RGB, of course, since it’s already in that mode. This worked for me with a test image I created:

from PIL import Image
im = Image.open(r"C:\jk.png")
bg = Image.new("RGB", im.size, (255,255,255))
bg.paste(im,im)
bg.save(r"C:\jk2.jpg")

Leave a Comment