import struct import zlib from pathlib import Path pixels = [bytes(4)] * (32 * 32) palette = { "#": "202835", # Outline "L": "eff7f4", # Steel highlight "S": "a8c0ca", # Steel "s": "617b8b", # Steel shadow "R": "f4d99a", # Rivet "h": "e5ac61", # Wood highlight "w": "b8753c", # Wood "d": "75452e", # Wood shadow } def dot(x, y, color): pixels[y * 32 + x] = bytes.fromhex(palette[color]) + b"\xff" # Diagonal handle, from bottom left to top right. for i in range(19): x, y = 6 + i, 26 - i for dx in (-1, 0, 1): for dy in (-1, 0, 1): dot(x + dx, y + dy, "#") for i in range(1, 18): x, y = 6 + i, 26 - i for dy, color in [(-1, "h"), (0, "w"), (1, "d")]: dot(x, y + dy, color) # Broad steel blade and riveted socket. head = [ " ####", " ###LLL#", " #LLLSSS#", " #LSSSSSS#", " #LSSSSSs##", "#LSSSSSsss##", "#LSSSSssssss###", "#LSSSsssssssSSs#", " #LSSsssssssSRSs#", " #LSssssssssSSs#", " #Ssssssss###", " #ssss###", " ####", ] for y, row in enumerate(head, 2): for x, color in enumerate(row, 9): if color != " ": dot(x, y, color) # Encode a standard RGBA PNG using only Python's standard library. def chunk(kind, data): return ( struct.pack(">I", len(data)) + kind + data + struct.pack(">I", zlib.crc32(kind + data) & 0xffffffff) ) raw = b"".join( b"\x00" + b"".join(pixels[y * 32:(y + 1) * 32]) for y in range(32) ) png = ( b"\x89PNG\r\n\x1a\n" + chunk(b"IHDR", struct.pack(">IIBBBBB", 32, 32, 8, 6, 0, 0, 0)) + chunk(b"IDAT", zlib.compress(raw)) + chunk(b"IEND", b"") ) Path("axe.png").write_bytes(png) print("Saved axe.png — 32×32, transparent")