from pathlib import Path
from PIL import Image, ImageDraw

OUT = Path(__file__).resolve().parent
image = Image.new('RGBA', (32, 32), (0, 0, 0, 0))
draw = ImageDraw.Draw(image)
outline = '#20232e'

# Integer coordinates and solid fills preserve crisp, true pixel-art edges.
# Ash handle runs from the lower left toward the upper right.
draw.polygon([(5, 26), (23, 8), (26, 11), (8, 29), (5, 29), (4, 28)], fill=outline)
draw.polygon([(6, 26), (23, 9), (24, 11), (7, 28), (5, 28)], fill='#87502f')
draw.line([(7, 26), (23, 10)], fill='#d69a57', width=1)
draw.line([(9, 26), (24, 11)], fill='#ad6b3b', width=1)
# Grip wraps and the dark pommel.
for x, y in [(7, 26), (9, 24), (11, 22)]:
    draw.line([(x-1, y-1), (x+1, y+1)], fill='#503b32', width=1)
draw.line([(5, 27), (6, 28)], fill='#b7804b')

# Broad crescent blade, facing upper left; a short poll faces lower right.
draw.polygon([(8, 3), (11, 5), (15, 6), (19, 5), (23, 8),
              (27, 12), (27, 15), (24, 18), (21, 15), (18, 12),
              (16, 16), (13, 19), (9, 18), (6, 15), (4, 11),
              (4, 7), (6, 4)], fill=outline)
# Steel face.
draw.polygon([(8, 4), (11, 6), (15, 7), (19, 6), (22, 9),
              (18, 11), (15, 15), (12, 17), (9, 16), (7, 13),
              (6, 9), (6, 6)], fill='#899eaf')
draw.polygon([(11, 7), (15, 8), (18, 7), (20, 9), (17, 10),
              (14, 14), (12, 15), (10, 13), (9, 10)], fill='#b1c5d0')
# Bright cutting edge and its inner bevel.
draw.line([(8, 4), (6, 5), (5, 7), (5, 11), (7, 15), (10, 17), (13, 18)], fill='#e9f4ef', width=1)
draw.line([(7, 7), (7, 10), (9, 14), (12, 16)], fill='#c6dbe0', width=1)
# Neck, socket, and square poll.
draw.polygon([(20, 8), (23, 9), (26, 12), (26, 14),
              (24, 16), (21, 13), (18, 11)], fill='#617787')
draw.line([(21, 9), (25, 13)], fill='#bdd0d7', width=1)
draw.line([(24, 15), (26, 13)], fill='#92a8b5', width=1)
draw.line([(19, 10), (23, 14)], fill='#394957', width=1)
draw.point((21, 11), fill='#e2e9d9')

image.save(OUT / 'axe_32x32.png')
image.resize((512, 512), Image.Resampling.NEAREST).save(OUT / 'axe_preview.png')
print(f'Saved {OUT / "axe_32x32.png"} (32 × 32 RGBA PNG)')
