[Image-SIG] Paste with alpha not working correctly

Helge image-sig at online.de
Sun Aug 29 19:42:00 CEST 2010


Hello Edward, hello list,

Edward Cannon schrieb:
> you are doing something "wrong." the paste command ignores the alpha
> channel entirely, the only
> way it will use it is if the image also used as a mask ie
>    comp.paste(fg, (0,0), fg)
> which will do what you will expect, use fg's mask to do the blending.
> adding a different mask
> is like replacing the alpha in fg with the different mask. The way to
> make a white blend to transparent
> is to make a white image and then add the gradient as a mask.

Sorry this does not solve my problem at all. I don't want to do a white 
blend to transparent but want to paste multiple images with mask on a 
transparent bg. Using code like this
fg=fg.convert("RGBA")
fg.putalpha(mask)
bg.paste(fg,(0,0),fg)
instead of using a separate mask in the paste call does not remove the 
tint from the bg but will apply the alpha twice (fg is less visible).

> I am not
> entirely sure if this will generalize
> to your bigger problem, if you still have trouble post a sample picture or two.

To clarify my intention: I want to make a collage of multiple images on 
a transparent bg with mask. So the blend should go from transparent to 
image for each image (and if already another image was pasted at the 
place this is taken into account). Result should be a png file with 
alpha that can be viewed on different background colors (or even 
images). The transparent parts should have no "tint" except the colors 
of my pasted images.

I uploaded an example here: 
<https://content.wuala.com/contents/nanyouco/Images/PIL/index.html?key=JWSJEVSOHCCJ>
There are only two variants in the upper table that are correct:
* the upper right corner of a collage on transparent "white" presented 
on a white bg
* the lower left corner of a collage on transparent "black" presented on 
a black bg
I was expecting in each table row all images appear identical (in all 
rows the same picture set is shown).

Best Regards,
Helge


More information about the Image-SIG mailing list