Detailed imp-style sprites for all 30 creatures in the high-res style; sprite texture in bands
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
210f17773a
commit
01e5326721
132 files changed
+1295
-43
No files matched your search
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python3
|
||||
# Pixelize all raw sheets to 32 and 64 px and build contact sheets.
|
||||
import os, subprocess, sys
|
||||
from PIL import Image
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
from creatures import CREATURES
|
||||
|
||||
D = "/home/zink/Projects/dungeoncraft/art/generated/sprites"
|
||||
T = "/home/zink/Projects/dungeoncraft/tools/pixelize_sprite.py"
|
||||
PY = "/tmp/sprvenv/bin/python"
|
||||
EXTRA = {} # id -> extra args
|
||||
for line in open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "extra.txt")) if os.path.exists(os.path.join(os.path.dirname(os.path.abspath(__file__)), "extra.txt")) else []:
|
||||
if line.strip():
|
||||
k, v = line.split(None, 1)
|
||||
EXTRA[k] = v.split()
|
||||
|
||||
ids = sys.argv[1:] or [c["id"] for c in CREATURES]
|
||||
for cid in ids:
|
||||
raw = f"{D}/{cid}-raw.png"
|
||||
if not os.path.exists(raw):
|
||||
print(cid, "missing raw"); continue
|
||||
for size, colors in ((32, 16), (64, 24)):
|
||||
cmd = [PY, "-I", T, raw, f"{D}/{cid}", "--views", "5", "--size", str(size), "--colors", str(colors),
|
||||
"--feet", str(size - 1), "--outline-weight", "0.6"] + EXTRA.get(cid, [])
|
||||
r = subprocess.run(cmd, capture_output=True, text=True)
|
||||
print(cid, size, (r.stdout + r.stderr).strip().splitlines()[-1:])
|
||||
prev = f"{D}/{cid}-{size}-preview.png"
|
||||
if os.path.exists(prev):
|
||||
os.remove(prev)
|
||||
|
||||
# contact sheets: 64 px versions at 2x with labels, 32 px at 2x beside
|
||||
from PIL import ImageDraw
|
||||
allids = [c["id"] for c in CREATURES]
|
||||
for part, chunk in enumerate((allids[:10], allids[10:20], allids[20:])):
|
||||
W = 320 * 2 + 20 + 160 * 2
|
||||
im = Image.new("RGBA", (W, len(chunk) * 140), (96, 92, 104, 255))
|
||||
d = ImageDraw.Draw(im)
|
||||
for i, cid in enumerate(chunk):
|
||||
y = i * 140
|
||||
d.text((2, y), cid, fill=(255, 255, 255, 255))
|
||||
for size, x, sc in ((64, 0, 2), (32, 660, 2)):
|
||||
p = f"{D}/{cid}-{size}.png"
|
||||
if os.path.exists(p):
|
||||
s = Image.open(p).convert("RGBA")
|
||||
s = s.resize((s.width * sc, s.height * sc), Image.NEAREST)
|
||||
im.alpha_composite(s, (x, y + 12))
|
||||
im.save(f"/tmp/sprites-contact-{part}.png")
|
||||
Reference in new issue
Block a user