"""Draw a diagonal axe with hard-edged pixels and export a 32x32 PNG.""" from pathlib import Path from PIL import Image, ImageDraw OUT = Path(__file__).resolve().parent im = Image.new("RGBA", (32, 32), (0, 0, 0, 0)) d = ImageDraw.Draw(im) outline = "#202632" # Hickory handle: every shape is drawn at native resolution, without smoothing. d.polygon([(11, 10), (14, 9), (29, 24), (29, 27), (27, 29), (24, 29), (10, 15)], fill=outline) d.polygon([(12, 12), (14, 11), (27, 24), (28, 26), (26, 28), (24, 27)], fill="#8d4d2d") d.line([(13, 12), (26, 25), (27, 25)], fill="#e7b76b", width=1) d.line([(12, 14), (25, 27)], fill="#b9783e", width=1) # Three dark grip wraps at the foot of the handle. for x, y in [(20, 22), (22, 24), (24, 26)]: d.line([(x, y), (x + 2, y - 2)], fill="#59392e", width=1) # Broad crescent blade, with a stepped cutting edge on the upper-left side. d.polygon([(3, 3), (7, 3), (8, 5), (10, 7), (14, 8), (18, 12), (13, 18), (9, 18), (6, 16), (4, 13), (3, 10), (2, 7), (2, 4)], fill=outline) d.polygon([(4, 4), (6, 4), (7, 6), (10, 9), (14, 10), (16, 12), (12, 16), (9, 16), (7, 14), (5, 11), (4, 8)], fill="#879eaf") d.polygon([(4, 4), (5, 4), (5, 8), (6, 11), (8, 14), (10, 16), (9, 16), (6, 14), (4, 10), (3, 7), (3, 4)], fill="#e7f5f5") d.polygon([(7, 7), (10, 9), (14, 10), (12, 12), (9, 11)], fill="#b7ccd5") d.polygon([(9, 14), (12, 14), (15, 11), (16, 12), (12, 16), (10, 16)], fill="#536b80") # Socket and short square poll, perpendicular to the diagonal handle. d.polygon([(12, 10), (18, 4), (21, 7), (15, 13)], fill=outline) d.polygon([(14, 10), (18, 6), (19, 7), (15, 11)], fill="#8399aa") d.line([(14, 9), (18, 5)], fill="#d4e4e8") d.polygon([(12, 11), (14, 9), (17, 12), (14, 15), (11, 12)], fill=outline) d.polygon([(13, 11), (14, 10), (16, 12), (14, 14), (12, 12)], fill="#637c90") d.point((14, 12), fill="#e7f5f5") im.save(OUT / "axe_32x32.png") im.resize((512, 512), Image.Resampling.NEAREST).save(OUT / "axe_preview.png") assert im.size == (32, 32) and im.mode == "RGBA" print(OUT / "axe_32x32.png")