Add 范德萨

main
mg4akq9nv 1 year ago
parent b09f5c601b
commit 9fe465f052

@ -0,0 +1,33 @@
from PIL import Image, ImageDraw, ImageFont
# 创建一个空白图像
width, height = 400, 400
image = Image.new("RGB", (width, height), "white")
draw = ImageDraw.Draw(image)
# 在图像上绘制小猪的身体
body_color = (255, 182, 193) # 浅粉色
body_radius = 150
body_center = (width // 2, height // 2)
draw.ellipse((body_center[0] - body_radius, body_center[1] - body_radius,
body_center[0] + body_radius, body_center[1] + body_radius), fill=body_color)
# 绘制小猪的眼睛
eye_color = (0, 0, 0) # 黑色
eye_radius = 20
eye_offset = 50
eye_positions = [(body_center[0] - eye_offset, body_center[1] - eye_offset),
(body_center[0] + eye_offset, body_center[1] - eye_offset)]
for eye_position in eye_positions:
draw.ellipse((eye_position[0] - eye_radius, eye_position[1] - eye_radius,
eye_position[0] + eye_radius, eye_position[1] + eye_radius), fill=eye_color)
# 绘制小猪的鼻子
nose_color = (255, 105, 180) # 粉红色
nose_radius = 30
nose_position = (body_center[0], body_center[1] + 20)
draw.ellipse((nose_position[0] - nose_radius, nose_position[1] - nose_radius,
nose_position[0] + nose_radius, nose_position[1] + nose_radius), fill=nose_color)
# 保存图片
image.save("pig.png")
Loading…
Cancel
Save