Hi,
I'm very new to PIL, and I'm exploring it as a way to rotate simple binary
images. Suppose I have an image like this:
0 0 0 0 0 0 0
0 0 0 1 0 0 0
0 0 0 1 0 0 0
0 0 0 1 0 0 0
0 0 1 1 1 0 0
0 1 1 1 1 1 0
0 0 0 0 0 0 0
created with:
from PIL import Image
im = Image.new('1', (7,7))
for p in [(1,3), (2,3), (3,3), (4,2), (4,3), (4,4),
(5,1), (5,2), (5,3), (5,4), (5,5)]:
im.putpixel(p, 1)
that I'd like to rotate 45 degrees:
im = im.rotate(45)
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 1 1 0
0 1 1 1 1 0 0
0 1 1 1 0 0 0
0 0 1 1 0 0 0
or with expansion:
im = im.rotate(45, expand=True)
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 1 0 0 0
0 0 1 1 1 1 0 0 0 0
0 0 0 1 1 1 0 0 0 0
0 0 0 0 1 1 0 0 0 0
0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 0 0 0
The results don't look 100% right.. Am I doing something wrong? Is there a
way to obtain better results?
Thanks,
Christian
_______________________________________________
Image-SIG maillist - [email protected]
http://mail.python.org/mailman/listinfo/image-sig