Hi

Two diffrent uses of rotate:

 1. img.rotate(30, Image.BICUBIC)
 2. img.rotate(30, Image.BICUBIC, expand=True)

When I use the first one I get the expected result. But when I use the second one the result looks as if the filter used for the rotation was Image.NEAREST.

Is this a "feature" or a bug? I'm no expert at image handling, so please explain this to me. Thanks.

Context:
Ubuntu 8.10, Python 2.5.2 and PIL 1.1.6

Testprogram:
#!/usr/bin/python
import Image
import ImageDraw

# Create a testimage
orig = Image.new('RGB',(250,250))
for x in range(0,250,50):
   for y in range(0,250,50):
       c = (x,y,100)
       orig.paste(c,(x,y,x+50,y+50))

# Create a target image
imout = Image.new('RGB', (750,600))

# Paste the orig image in various ways
imout.paste(orig,(0,0))
imout.paste(orig.rotate(30,Image.NEAREST), (250,0))
imout.paste(orig.rotate(30,Image.BICUBIC,False), (500,0))
imout.paste(orig.rotate(30,Image.BICUBIC,True), (300,250))

# Put some labels on the output
draw = ImageDraw.Draw(imout)
draw.text((10,10),'Original',fill=(255,255,0))
draw.text((260,10),'30 degrees, NEAREST, expand=False',fill=(255,255,0))
draw.text((510,10),'30 degrees, BICUBIC, expand=False',fill=(255,255,0))
draw.text((310,500),'30 degrees, BICUBIC, expand=True',fill=(255,255,0))

imout.show()
### end of program ###


/Ulf Renman
_______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig

Reply via email to