2026. június 30., kedd

A python program rajzol egy kezdetleges női arcot

A python program rajzol egy női arcot
--------------
from PIL import Image, ImageDraw


def draw_face(size=1024):
    img = Image.new("RGB", (size, size), (248, 238, 230))
    draw = ImageDraw.Draw(img)
    cx, cy = size // 2, size // 2

    skin = (244, 220, 205)
    hair = (100, 72, 62)
    hair_light = (125, 92, 78)
    eye_white = (255, 255, 255)
    iris = (72, 102, 132)
    pupil = (25, 25, 25)
    brow = (92, 64, 52)
    blush = (236, 182, 178)
    lip = (198, 94, 118)
    lip_dark = (160, 60, 90)
    neck = (235, 205, 190)
    shoulders = (214, 184, 174)

    # Hair
    draw.ellipse((cx - 290, cy - 390, cx + 290, cy + 120), fill=hair)
    draw.ellipse((cx - 330, cy - 120, cx - 175, cy + 320), fill=hair)
    draw.ellipse((cx + 175, cy - 120, cx + 330, cy + 320), fill=hair)
    draw.ellipse((cx - 220, cy - 410, cx + 220, cy - 120), fill=hair_light)

    # Face
    draw.ellipse((cx - 205, cy - 270, cx + 205, cy + 235), fill=skin)

    # Neck and shoulders
    draw.ellipse((cx - 65, cy + 185, cx + 65, cy + 330), fill=neck)
    draw.ellipse((cx - 320, cy + 290, cx + 320, cy + 520), fill=shoulders)

    # Eyes
    eye_y = cy - 55
    eye_dx = 92
    eye_r = 24
    iris_r = 12
    pupil_r = 5

    for ex in [cx - eye_dx, cx + eye_dx]:
        draw.ellipse((ex - eye_r, eye_y - eye_r, ex + eye_r, eye_y + eye_r), fill=eye_white)
        draw.ellipse((ex - iris_r, eye_y - iris_r, ex + iris_r, eye_y + iris_r), fill=iris)
        draw.ellipse((ex - pupil_r, eye_y - pupil_r, ex + pupil_r, eye_y + pupil_r), fill=pupil)

    # Brows
    draw.line((cx - 130, eye_y - 42, cx - 58, eye_y - 50), fill=brow, width=8)
    draw.line((cx + 58, eye_y - 50, cx + 130, eye_y - 42), fill=brow, width=8)

    # Nose
    draw.ellipse((cx - 12, cy - 5, cx + 12, cy + 78), fill=(225, 190, 175))

    # Cheeks
    draw.ellipse((cx - 132, cy + 10, cx - 88, cy + 48), fill=blush)
    draw.ellipse((cx + 88, cy + 10, cx + 132, cy + 48), fill=blush)

    # Lips and smile
    draw.arc((cx - 88, cy + 72, cx + 88, cy + 150), start=20, end=160, fill=lip_dark, width=7)
    draw.ellipse((cx - 66, cy + 98, cx + 66, cy + 128), fill=lip)

    return img


if __name__ == "__main__":
    face = draw_face()
    face.save("noi_arc.png")
    print("Kész! Mentve: noi_arc.png")
-------------------
https://www.onlinegdb.com/online_python_compiler#
----------------------

Sic semper tyrannus  
szcenárió (forgatókönyv 

Nincsenek megjegyzések:

Megjegyzés küldése