39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
from PIL import Image, ImageDraw
|
|
|
|
def make_icon(size):
|
|
img = Image.new("RGBA", (size, size), (0,0,0,0))
|
|
d = ImageDraw.Draw(img)
|
|
s = size / 128.0 # scala
|
|
|
|
def P(x, y):
|
|
return (int(x*s), int(y*s))
|
|
|
|
# Sfondo circolare blu-navy con bordo
|
|
d.ellipse([P(4,4), P(124,124)], fill=(20,36,60,255), outline=(42,74,107,255), width=int(3*s))
|
|
|
|
# Corpo del notepad (rettangolo arrotondato, carta chiara)
|
|
pad = [P(30,20), P(98,112)]
|
|
d.rounded_rectangle(pad, radius=int(8*s), fill=(224,232,244,255))
|
|
|
|
# Spirale in alto
|
|
for i in range(3):
|
|
x = 44 + i*18
|
|
d.ellipse([P(x,16), P(x+6,24)], fill=(42,74,107,255))
|
|
|
|
# Righe di testo
|
|
line_color = (150,168,196,255)
|
|
for i in range(5):
|
|
y = 38 + i*14
|
|
d.line([P(38,y), P(90,y)], fill=line_color, width=int(3*s))
|
|
|
|
# Penna (diagonale, oro)
|
|
pen = [(92,30),(112,92),(104,96),(82,34)]
|
|
d.polygon(pen, fill=(217,180,90,255))
|
|
d.polygon([(112,92),(116,86),(108,94)], fill=(217,180,90,255))
|
|
|
|
return img
|
|
|
|
for sz in [16, 32, 48, 128]:
|
|
make_icon(sz).save(f"icons/icon{sz}.png")
|
|
print("creato", sz)
|