Claimed floors reworked: roughly hewn castle flagstones worn smooth, no visible tile grid

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-07 21:52:33 +01:00
1 parent aab466cfbe
commit 72c44ae8d0
35 files changed
+54 -28

No files matched your search

+25 -5
View File
@@ -6,10 +6,13 @@ palette shared by all tiles of the sheet.
Usage:
make_floor_tiles.py raw.png out_prefix --grid 2x3 --pick 1,2,3,5,6 [--size 128]
[--colors 48] [--bright 1.0]
[--colors 48] [--bright 1.0] [--inset 0.0] [--flatten]
--pick which cells to keep, numbered row by row from 1
--bright factor on the colours (above 1: lighter)
--inset cut this share off every side (a frame or edge joint the model drew around the tile)
--flatten even out the light: no vignette towards the edges, all tiles equally bright, so
the grid of tiles does not show on the floor
Writes out_prefix-<size>.png: the picked tiles side by side, and out_prefix-<size>-preview.png
(a 6x4 floor of them laid out at random, scaled up 2x). Needs Pillow.
@@ -17,7 +20,7 @@ Writes out_prefix-<size>.png: the picked tiles side by side, and out_prefix-<siz
import argparse
import random
from PIL import Image, ImageEnhance
from PIL import Image, ImageEnhance, ImageFilter, ImageStat
VOID = (22, 14, 18)
@@ -36,6 +39,8 @@ def main():
ap.add_argument("--size", type=int, default=128)
ap.add_argument("--colors", type=int, default=48)
ap.add_argument("--bright", type=float, default=1.0)
ap.add_argument("--inset", type=float, default=0.0)
ap.add_argument("--flatten", action="store_true")
a = ap.parse_args()
rows, cols = (int(v) for v in a.grid.split("x"))
pick = [int(v) - 1 for v in a.pick.split(",")]
@@ -56,9 +61,24 @@ def main():
for x in range(tile.width):
if magenta(tp[x, y]):
tp[x, y] = VOID
if a.bright != 1.0:
tile = ImageEnhance.Brightness(tile).enhance(a.bright)
tiles.append(tile.resize((a.size, a.size), Image.LANCZOS))
if a.inset > 0:
d = int(tile.width * a.inset)
tile = tile.crop((d, d, tile.width - d, tile.height - d))
tiles.append(tile)
if a.flatten:
# divide by the large-scale brightness: every tile gets the same, even brightness (the
# sheet's mean), so neither a vignette nor a lighter or darker tile shows the grid
blurs = [t.convert("L").filter(ImageFilter.GaussianBlur(t.width / 5)) for t in tiles]
mean = sum(ImageStat.Stat(b).mean[0] for b in blurs) / len(blurs)
for t, blur in zip(tiles, blurs):
bp, tp = blur.load(), t.load()
for y in range(t.height):
for x in range(t.width):
f = mean / max(bp[x, y], 1)
tp[x, y] = tuple(min(255, int(c * f)) for c in tp[x, y])
if a.bright != 1.0:
tiles = [ImageEnhance.Brightness(t).enhance(a.bright) for t in tiles]
tiles = [t.resize((a.size, a.size), Image.LANCZOS) for t in tiles]
strip = Image.new("RGB", (a.size * len(tiles), a.size))
for k, t in enumerate(tiles):