[Image-SIG] rotate image with transparent background?

Douglas Bagnall douglas at paradise.net.nz
Thu Jan 18 05:13:15 CET 2007

Alec Bennett wrote:
> Hmm, still getting a black box. The code as it stands now in case
> anything jumps out at you:

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

That should be

im1 = Image.open("pic1.jpg")
im1 = im1.convert('RGBA')
or more concisely

im1 = Image.open("pic1.jpg").convert('RGBA')

Like most PIL methods, convert() returns the modified image, leaving the
original one as is.


More information about the Image-SIG mailing list