I am trying to draw a simple circle and save this to a file using the Python Imaging Library:
import Image, ImageDraw
image = Image.new('RGBA', (200, 200))
draw = ImageDraw.Draw(image)
draw.ellipse((20, 180, 180, 20), fill = 'blue', outline ='blue')
draw.point((100, 100), 'red')
image.save('test.png')
The point draw.point appears on the image, but the ellipse itself does not. I tried changing the mode to just RGB (I thought the mode might affect what is displayed), but this did not solve it.
How can I fix this? Thanks!
解决方案
Instead of specifying the upper right and lower left coordinates, swap them to get the upper left and lower right.
draw.ellipse((20, 20, 180, 180), fill = 'blue', outline ='blue')