1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
import Image import ImageDraw
img = Image.new('RGB', (600, 600)) draw = ImageDraw.ImageDraw(img)
draw.ellipse((250, 20, 350, 120), fill='yellow')
draw.chord((250, 50, 300, 160), 240, 300, fill='red')
draw.chord((300, 50, 350, 160), 240, 300, fill='red')
draw.arc((250, 0, 350, 100), 60, 120, fill='red')
draw.line((300, 120, 300, 360), fill='yellow')
draw.arc((200, 150, 400, 350), 200, 340, fill='yellow')
draw.line((300, 360, 200, 500), fill='green')
draw.line((300, 360, 400, 500), fill='green')
colors = ['red', 'orange', 'yellow', 'green', 'cyan' ,'blue', 'purple'] for i, c in enumerate(colors): draw.rectangle((50+20*i, 20, 60+20*i, 120), fill=c) img.show()
|
近期评论