[Tutor] transpose problems in PIL

kromag@nsacom.net kromag@nsacom.net
Mon, 6 Aug 2001 15:23:09 -0700 (PDT)


Howdy. 

For some strange reason that I cannot fathom I am having difficulty with 
transpose() in PIL.

To wit:

import Image
import os
import sys
background=Image.open("\windows\desktop\doug.jpg")
clip1=Image.open("\windows\desktop\robo.gif")
clip2=clip1.transpose(Image.ROTATE_180)
clip3=clip1.transpose(Image.FLIP_RIGHT_LEFT)
clip4=clip2.transpose(Image.FLIP_RIGHT_LEFT)
pos1=(10,10,94,92)
pos2=(10,385,94,467)
pos3=(296,10,380,92)
pos4=(296,387,380,469)
background.paste(clip1,pos1)
background.paste(clip2, pos2)
background.paste(clip3,pos3)
background.paste(clip4,pos4)
background.save("\windows\desktop\test.jpg","JPEG")


it gives me the error:


>pythonw -u card_builder.py
Traceback (most recent call last):
  File "card_builder.py", line 7, in ?
    clip3=clip1.transpose(Image.FLIP_RIGHT_LEFT)
AttributeError: FLIP_RIGHT_LEFT
>Exit code: 1

Image.ROTATE_180 works just fine. Clues?