[Image-SIG] rotate image with transparent background?

Douglas Bagnall douglas at paradise.net.nz
Thu Jan 18 05:56:06 CET 2007

Alec Bennett wrote:

> collage.paste(im2, (30, 30) )

>From http://effbot.org/imagingbook/image.htm#Image.paste :

  im.paste(image, box, mask)

  Same as above, but updates only the regions indicated by the
  mask. You can use either "1", "L" or "RGBA" images (in the latter
  case, the alpha band is used as mask). Where the mask is 255, the
  given image is copied as is. Where the mask is 0, the current value
  is preserved. Intermediate values can be used for transparency

  Note that if you paste an "RGBA" image, the alpha band is
  ignored. You can work around this by using the same image as both
  source image and mask.

so you want

collage.paste(im2, (30, 30), im2)


More information about the Image-SIG mailing list