draw vegeta in python

To draw Vegeta in Python, we will use the Python Imaging Library (PIL), which allows us to create and manipulate images.

First, we'll create a new image with a white background:

main.py
from PIL import Image, ImageDraw

width, height = 500, 500
img = Image.new('RGB', (width, height), (255, 255, 255))
draw = ImageDraw.Draw(img)
143 chars
6 lines

Next, we can start drawing Vegeta's features. For example, we can draw his hair using a series of polygons:

main.py
hair_color = (42, 37, 38)

hair = [
    (50, 50),
    (100, 100),
    (200, 120),
    (250, 100),
    (300, 80),
    (350, 100),
    (400, 120),
    (450, 100),
    (400, 50),
    (350, 25),
    (300, 25),
    (250, 25),
    (200, 25),
    (150, 25),
    (100, 25),
    (50, 50),
]

draw.polygon(hair, fill=hair_color)
319 chars
23 lines

We can add additional polygons to fill in the rest of his features, such as his face, body, and clothes:

main.py
face_color = (220, 184, 135)
body_color = (82, 135, 243)
clothes_color = (153, 12, 21)

face = [
    (200, 150),
    (250, 200),
    (200, 250),
]

body = [
    (200, 250),
    (250, 300),
    (300, 450),
    (200, 400),
]

clothes = [
    (200, 250),
    (200, 400),
    (150, 350),
]

# Draw polygons for face, body, and clothes
draw.polygon(face, fill=face_color)
draw.polygon(body, fill=body_color)
draw.polygon(clothes, fill=clothes_color)
445 chars
28 lines

Finally, we can save the image and display it:

main.py
img.save('vegeta.png')
img.show()
34 chars
3 lines

This will create an image of Vegeta with a background, hair, face, body, and clothes. You can adjust the coordinates and colors to create different versions of Vegeta.

gistlibby LogSnag