#!/usr/bin/env python3 """게임패스·개발자 상품 아이콘(512x512 PNG)을 그립니다. 외부 그림을 쓰지 않아 저작권 걱정이 없습니다. python3 tools/art.py # art/*.png 생성 """ import math import os from PIL import Image, ImageDraw, ImageFilter, ImageFont OUT = os.path.join(os.path.dirname(__file__), "..", "art") BOLD = "/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc" S = 512 def font(size): return ImageFont.truetype(BOLD, size, index=1) # KR def background(c1, c2): img = Image.new("RGBA", (S, S)) d = ImageDraw.Draw(img) for y in range(S): t = y / S col = tuple(int(c1[i] * (1 - t) + c2[i] * t) for i in range(3)) + (255,) d.line([(0, y), (S, y)], fill=col) # 햇살 무늬 rays = Image.new("RGBA", (S, S), (0, 0, 0, 0)) rd = ImageDraw.Draw(rays) for i in range(16): a0 = i * math.pi / 8 a1 = a0 + math.pi / 16 rd.polygon([(S / 2, S / 2), (S / 2 + 800 * math.cos(a0), S / 2 + 800 * math.sin(a0)), (S / 2 + 800 * math.cos(a1), S / 2 + 800 * math.sin(a1))], fill=(255, 255, 255, 40)) img.alpha_composite(rays) mask = Image.new("L", (S, S), 0) ImageDraw.Draw(mask).rounded_rectangle([0, 0, S - 1, S - 1], radius=90, fill=255) out = Image.new("RGBA", (S, S), (0, 0, 0, 0)) out.paste(img, (0, 0), mask) return out def coin(d, cx, cy, r): d.ellipse([cx - r, cy - r, cx + r, cy + r], fill=(255, 200, 40), outline=(190, 120, 10), width=max(4, r // 8)) d.ellipse([cx - r * 0.65, cy - r * 0.65, cx + r * 0.65, cy + r * 0.65], outline=(230, 160, 20), width=max(3, r // 12)) f = font(int(r * 1.0)) d.text((cx, cy - r * 0.05), "₩", font=f, fill=(190, 120, 10), anchor="mm") def outlined(d, xy, text, f, fill, stroke, width): d.text(xy, text, font=f, fill=fill, anchor="mm", stroke_width=width, stroke_fill=stroke) def shadow(img): sh = img.copy().filter(ImageFilter.GaussianBlur(6)) return sh def double_money(): img = background((170, 90, 230), (90, 40, 170)) d = ImageDraw.Draw(img) for (x, y, r) in [(140, 330, 80), (370, 350, 70), (255, 395, 90)]: coin(d, x, y, r) outlined(d, (256, 190), "x2", font(250), (255, 230, 60), (90, 30, 120), 14) return img def money_boost(): img = background((255, 190, 60), (240, 110, 30)) d = ImageDraw.Draw(img) for (x, y, r) in [(130, 380, 70), (385, 380, 70), (256, 410, 80)]: coin(d, x, y, r) bolt = [(290, 40), (150, 270), (245, 270), (205, 430), (360, 200), (265, 200), (320, 40)] d.polygon(bolt, fill=(255, 250, 120), outline=(160, 70, 0)) d.line(bolt + [bolt[0]], fill=(160, 70, 0), width=12, joint="curve") return img def main(): os.makedirs(OUT, exist_ok=True) for name, fn in [("double_money", double_money), ("money_boost", money_boost)]: path = os.path.join(OUT, name + ".png") fn().save(path) print(path) if __name__ == "__main__": main()