from PIL import Image, ImageDraw # Creates a new image with the desired resolution (4K) width = 3840 height = 2160 image = Image.new("RGB", (width, height), "black") draw = ImageDraw.Draw(image) # Defines the colors used armor_color = (0, 0, 0) # Armor color helmet_color = (0, 0, 0) # Helmet color glass_color = (255, 0, 0) # Color of red glasses gas_mask_color = (255, 255, 255) # Gas mask color # Defines the dimensions of the armor and helmet armor_width = width armor_height = height * 0.8 helmet_width = width * 0.4 helmet_height = height * 0.3 # Draw the armor armor_position = ((width - armor_width) // 2, (height - armor_height) // 2) draw.rectangle([armor_position, (armor_position[0] + armor_width, armor_position[1] + armor_height)], fill=armor_color) # Designs the World War II helmet helmet_position = ((width - helmet_width) // 2, (height - helmet_height) // 2) draw.rectangle([helmet_position, (helmet_position[0] + helmet_width, helmet_position[1] + helmet_height)], fill=helmet_color) # Defines the dimensions and position of the glasses glass_radius = min(helmet_width, helmet_height) * 0.2 glass_position = ((width - glass_radius * 2) // 2, (height - glass_radius * 2) // 2) # Draw the round and red glasses draw.ellipse([glass_position, (glass_position[0] + glass_radius * 2, glass_position[1] + glass_radius * 2)], fill=glass_color) # Defines the dimensions and position of the gas mask gas_mask_width = helmet_width * 0.8 gas_mask_height = helmet_height * 0.4 gas_mask_position = ((width - gas_mask_width) // 2, (height + helmet_height) // 2) # Draws the gas mask draw.rectangle([gas_mask_position, (gas_mask_position[0] + gas_mask_width, gas_mask_position[1] + gas_mask_height)], fill=gas_mask_color) # Saves the generated image image.save("policial_futurista.png")