[Image-SIG] Pasting images

Eric S. Raymond esr@snark.thyrsus.com
Thu, 9 Jan 2003 06:03:38 -0500


I'm confused by the behavior of the paste() method.  I'm trying to
paste a PNG image onto a background generated by Image,new().

It appears to me from the manual that if flag.png is a 30x30 image,
the following sequence of operations

im = Image.new("P", (60, 60))
flag = Image.open("flag.png")
im.paste(flag, (15, 15))

ought to leave the flag pasted onto the middle of a black background.

It doesn't.  All I see is black.

PIL 1.1.3, Python 2.3a0, Red Hat 8.0.

While we're att it, how do I generate a new image that is transparent?  
Or set a transparency color on an existing image?  Setting the
'transparency' memeber of an image's info dict doesn't seem to do it.

What am I doing wrong?
-- 
		<a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a>

As with the Christian religion, the worst advertisement for Socialism
is its adherents.
	-- George Orwell