Transparent PNG in PIL turns out not to be transparent Transparent PNG in PIL turns out not to be transparent python python

Transparent PNG in PIL turns out not to be transparent


I think what you want to use is the paste mask argument.see the docs, (scroll down to paste)

from PIL import Imageimg = Image.open(basefile)layer = Image.open(layerfile) # this file is the transparent oneprint layer.mode # RGBAimg.paste(layer, (xoff, yoff), mask=layer) # the transparancy layer will be used as the maskimg.save(outfile)