"""Draw a diagonal 32x32 pixel axe without antialiasing.""" 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) ink = "#202536" wood_dark = "#704332" wood = "#ad6b3e" wood_light = "#e7a65b" steel_dark = "#526579" steel = "#8ea7b5" steel_light = "#c8e0e3" edge = "#f0f6eb" # The haft runs from the lower left to the upper right. d.polygon([(4, 26), (21, 9), (24, 9), (26, 11), (26, 13), (9, 30), (6, 30), (4, 28)], fill=ink) d.polygon([(5, 26), (22, 10), (24, 11), (25, 12), (8, 29), (6, 29), (5, 28)], fill=wood_dark) d.polygon([(6, 26), (22, 10), (24, 11), (8, 27), (6, 28)], fill=wood) d.line([(6, 26), (21, 11)], fill=wood_light, width=1) d.line([(12, 23), (14, 21)], fill=wood_dark, width=1) # Broad, stepped cutting blade; hard pixel boundaries are intentional. d.polygon([(4, 7), (6, 4), (9, 2), (12, 1), (13, 1), (14, 4), (16, 6), (19, 7), (22, 7), (25, 10), (25, 13), (22, 16), (19, 13), (16, 12), (13, 14), (10, 14), (7, 12), (5, 9)], fill=ink) d.polygon([(5, 7), (7, 4), (10, 2), (12, 2), (13, 5), (16, 8), (20, 9), (21, 12), (18, 11), (15, 11), (12, 13), (10, 13), (8, 11), (6, 9)], fill=steel) d.polygon([(5, 7), (7, 4), (10, 2), (12, 2), (11, 4), (8, 6), (7, 8), (9, 11), (11, 13), (10, 13), (8, 11), (6, 9)], fill=steel_light) d.line([(5, 7), (7, 4), (10, 2), (12, 2)], fill=edge) d.polygon([(9, 9), (12, 10), (15, 9), (18, 10), (21, 12), (18, 11), (15, 11), (12, 13)], fill=steel_dark) d.line([(13, 5), (16, 8), (19, 9)], fill=steel_light) # The socket and squared poll sit across the handle. d.polygon([(20, 8), (22, 8), (26, 12), (27, 12), (28, 14), (24, 18), (22, 17), (22, 15), (19, 12), (19, 10)], fill=ink) d.polygon([(21, 9), (22, 9), (25, 12), (22, 15), (20, 12), (20, 10)], fill=steel_dark) d.line([(21, 9), (24, 12)], fill=steel_light) d.line([(20, 11), (22, 13)], fill=steel) d.polygon([(26, 13), (27, 14), (24, 17), (23, 16)], fill=steel) d.line([(26, 13), (23, 16)], fill=steel_light) d.point((22, 11), fill=ink) # A short dark wrap near the butt adds readable texture at native size. d.line([(7, 24), (10, 27)], fill=ink) d.line([(9, 22), (12, 25)], fill=ink) d.line([(8, 24), (9, 25)], fill=wood_light) d.line([(10, 22), (11, 23)], fill=wood_light) im.save(OUT / "diagonal_axe_32x32.png") im.resize((512, 512), Image.Resampling.NEAREST).save(OUT / "diagonal_axe_preview.png") assert im.size == (32, 32) and im.mode == "RGBA" print(OUT / "diagonal_axe_32x32.png")