#!/usr/bin/env python3 """Generates a 256x256 Sculpt Engine icon PNG (stdlib only): a gold isometric cube with a carved doorway.""" import struct import sys import zlib W = H = 256 CX, CY, S = 128, 130, 84 def pixel(x, y): t = y / H color = (int(18 + 14 * t), int(24 + 18 * t), int(34 + 26 * t)) # steel-blue gradient dx, dy = x - CX, y - CY # Isometric hexagon silhouette if abs(dx) <= S * 0.87 and abs(dy) <= S and abs(dx) * 0.577 + abs(dy) <= S: if dy < -abs(dx) * 0.577 + S * 0.0 and dy < 0 and (-dy) > abs(dx) * 0.577: color = (236, 196, 92) # top face elif dx < 0: color = (150, 120, 52) # left face else: color = (105, 84, 38) # right face if 14 < dx < 48 and 4 < dy < 62: color = (16, 20, 28) # carved doorway (Subtract) return color + (255,) raw = bytearray() for y in range(H): raw.append(0) for x in range(W): raw.extend(pixel(x, y)) def chunk(tag, data): body = tag + data return struct.pack(">I", len(data)) + body + struct.pack(">I", zlib.crc32(body) & 0xFFFFFFFF) png = b"\x89PNG\r\n\x1a\n" png += chunk(b"IHDR", struct.pack(">IIBBBBB", W, H, 8, 6, 0, 0, 0)) png += chunk(b"IDAT", zlib.compress(bytes(raw), 9)) png += chunk(b"IEND", b"") with open(sys.argv[1], "wb") as f: f.write(png)