from PIL import Image, ImageDraw # Create a new image with RGB mode image = Image.new("RGB", (200, 200), "blue") # Draw a red rectangle on the image draw = ImageDraw.Draw(image) draw.rectangle([(50, 50), (150, 150)], fill="red") # Show the image image