原始问题:
使用代码生成一个黑神话悟空的人面像
下面是一段Python代码,可以用来生成黑神话悟空的人脸像:
from PIL import Image, ImageDraw
import numpy as np
Create an image with the given size
img = Image.new('RGB', (200, 200), color = 'black')
Create a draw object to draw on the new image
draw = ImageDraw.Draw(img)
# Draw a circle on the image using numpy and the given parameters
x_center, y_center = 100, 100 # center of circle
# Draw a circle on the image using numpy and the given parameters draw.ellipse((x_center-50, y_center-50, x_center+50, y_center+50), fill='white')
# Draw eyes of Wukong on the face draw.ellipse((75, 75 , 125 , 125), fill='blue') draw.ellipse((175 , 75 , 125 , 125), fill='blue')
# Draw a nose of Wukong draw.polygon([(100, 150) , (125 , 175) , (75 , 175)] ,fill='red' )
# Show/save your drawing img.show()
Prev:如何在支教中获得孩子信任