"""Draw a 32x32 pixel-art archery bow. Requires Pillow: pip install pillow.""" 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) INK = "#392720" WOOD = "#AE6435" SHADE = "#774127" LIGHT = "#E5A25A" GOLD = "#D8A447" GOLD_LIGHT = "#FFE09A" LEATHER = "#593A32" WRAP = "#AF7550" STRING = "#F4E6BC" # A one-pixel bowstring, shaded along its underside for readability. draw.line([(27, 5), (5, 27)], fill="#76664E", width=1) draw.line([(26, 4), (4, 26)], fill=STRING, width=1) # Stepped silhouette: a wooden recurve bow from lower left to upper right. # Every shape is rasterized at the final resolution without antialiasing. draw.polygon( [ (27, 3), (28, 4), (27, 7), (23, 7), (20, 8), (17, 9), (14, 11), (11, 14), (9, 17), (8, 20), (7, 23), (7, 27), (4, 28), (3, 27), (3, 23), (4, 19), (5, 16), (7, 12), (9, 9), (12, 7), (16, 5), (19, 4), (23, 3), ], fill=INK, ) draw.polygon( [ (25, 4), (26, 5), (25, 6), (22, 6), (19, 7), (16, 8), (13, 10), (10, 13), (8, 16), (7, 19), (6, 22), (6, 25), (5, 26), (4, 25), (4, 23), (5, 19), (6, 16), (8, 12), (10, 10), (12, 8), (16, 6), (19, 5), (23, 4), ], fill=WOOD, ) draw.line([(24, 5), (21, 5), (17, 6), (13, 8), (11, 9)], fill=LIGHT) draw.line([(9, 11), (8, 13), (6, 17), (5, 21), (5, 24)], fill=LIGHT) draw.line([(24, 6), (21, 7), (18, 8), (15, 10)], fill=SHADE) draw.line([(10, 15), (8, 18), (7, 21), (6, 24)], fill=SHADE) # Dark leather handle with three distinct diagonal wraps. draw.polygon([(8, 10), (10, 8), (14, 8), (15, 10), (10, 15), (8, 14)], fill=INK) draw.polygon([(9, 10), (11, 9), (13, 9), (14, 10), (10, 14), (9, 13)], fill=LEATHER) draw.line([(11, 9), (13, 11)], fill=WRAP) draw.line([(9, 10), (11, 12)], fill=WRAP) draw.line([(9, 12), (10, 13)], fill=WRAP) # Brass nocks tie the string to both recurved tips. draw.line([(24, 4), (26, 4), (26, 6)], fill=GOLD, width=1) draw.point((25, 4), fill=GOLD_LIGHT) draw.line([(4, 24), (4, 26), (6, 26)], fill=GOLD, width=1) draw.point((4, 25), fill=GOLD_LIGHT) image.save(OUT / "archery_bow.png") # Optional enlarged preview; the exported sprite above remains exactly 32x32. preview = image.resize((384, 384), Image.Resampling.NEAREST) preview.save(OUT / "archery_bow_preview.png") print(f"Saved {OUT / 'archery_bow.png'} (32x32 RGBA)")