Untitled
unknown
plain_text
2 years ago
759 B
3
Indexable
from PIL import Image, ImageDraw # Create a blank image with a white background width, height = 400, 400 image = Image.new('RGB', (width, height), 'white') # Create a draw object to draw on the image draw = ImageDraw.Draw(image) # Draw the body of the bird using rectangles and ellipses draw.rectangle((100, 50, 150, 100), fill='blue') draw.rectangle((150, 50, 200, 100), fill='blue') draw.ellipse((100, 100, 200, 150), fill='blue') # Draw the head of the bird using circles and triangles draw.polygon([(75, 25), (100, 50), (50, 50)], fill='yellow') draw.polygon([(200, 25), (225, 50), (175, 50)], fill='yellow') draw.ellipse((50, 25, 75, 50), fill='yellow') draw.ellipse((225, 25, 250, 50), fill='yellow') # Save the image image.save('cubist_bird.jpg')
Editor is loading...