[Image-SIG] rotate image with transparent background?

Alec Bennett wrybread at gmail.com
Thu Jan 18 01:50:06 CET 2007


I'm trying to rotate an image and have the expanded background be transparent.

For example:

im = Image.open("pic1.jpg")
im2 = im.rotate(32, expand = 1)
im2.show()

In the above, im2 is a copy of pic1.jpg that has been rotated 32
degrees. The problem is that the background over where it was rotated
is a black box.

Is there a way to make that background transparent? I'll be pasting
the image onto another image, and don't want a bunch of black shapes.

Thanks for any help.


More information about the Image-SIG mailing list