Douglas helped me off list, wanted to post the complete code in case
anyone else comes looking.  So here's the code to rotate an image and
paste it onto another image without creating a black bounding box:


from PIL import Image

collage = Image.open("cheese.jpg")

# open the pic and give it an alpha channel so it's transparent
im1 = Image.open("pic1.jpg").convert('RGBA')

# rotate it and expand it's canvas so the corners don't get cut off:
im2 = im1.rotate(32, expand = 1)

# note the second appearance of im2, that's necessary to paste without a bg
collage.paste(im2, (30, 30), im2 )
collage.save("new.jpg")

collage.show()
_______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig

Reply via email to