from PIL import Image 
from PIL import ImageDraw, ImageFont

PATH = "/home/cugur/Downloads/matf/dozs/2024/week4/data/yugo.jpg"

with Image.open(PATH) as img:

    # originalna slika
    img.show()

    # neka slika bude sto svetlija - kao background
    img = img.point(lambda p: p + 100)
    img.show()

    # priprema za crtanje
    d = ImageDraw.Draw(img)

    # Crtanje
    d.rectangle((50, 50, 450, 450), outline='black', fill='gray')
    d.rectangle((50, 50, 350, 350), outline='black', fill='yellow')
    d.rectangle((50, 50, 250, 250), outline='black', fill='white')
    d.rectangle((50, 50, 150, 150), outline='black', fill='green')

    d.line((450, 450, 1000, 666), fill=140)

    d.ellipse((80, 40, 100, 180), fill = 'blue', outline ='blue')

    d.ellipse((100, 100, 180, 180), fill = 'yellow', outline ='blue')

    # Pisanje po slici
    fnt = ImageFont.truetype("/home/cugur/Downloads/matf/dozs/2024/week4/fonts/amatic/Amatic-Bold.ttf", 60)
    d.text((250, 250), "Matf + UU", font=fnt, fill=(0, 0, 190))

    fnt2 = ImageFont.truetype("/home/cugur/Downloads/matf/dozs/2024/week4/fonts/chunkfive/ChunkFive-Regular.otf", 30)
    d.text((50, 500), "Digitalna obrada zvuka i slike", font=fnt2, fill=(50, 50, 80))

    img.show()

    # Link za preuzimanje fontova: https://www.fontsquirrel.com/fonts/list/popular