86 lines
3.0 KiB
Python
86 lines
3.0 KiB
Python
#!/usr/bin/env python3
|
|
"""Create non-production art-review evidence for John the Baptist candidate 05."""
|
|
from pathlib import Path
|
|
|
|
from PIL import Image, ImageDraw, ImageFont
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
REPO = next(p for p in ROOT.parents if (p / "docs/card-art-brief.md").is_file())
|
|
SOURCE = ROOT / "source"
|
|
OUT = ROOT / "review/candidate-05"
|
|
OUT.mkdir(parents=True, exist_ok=True)
|
|
|
|
candidate = Image.open(SOURCE / "art-native-candidate-05.png").convert("RGBA")
|
|
parent = Image.open(SOURCE / "art-native-candidate-04.png").convert("RGBA")
|
|
|
|
for width in (1000, 500, 250):
|
|
candidate.resize((width, width * 7 // 5), Image.Resampling.LANCZOS).save(
|
|
OUT / f"art-{width}.png"
|
|
)
|
|
|
|
crops = {
|
|
"john-face-hair-beard-200.png": (200, 145, 510, 430, 2),
|
|
"john-raised-hand-200.png": (45, 105, 190, 425, 2),
|
|
"john-guiding-hand-300.png": (420, 470, 615, 690, 3),
|
|
"baptism-subject-face-300.png": (500, 500, 725, 740, 3),
|
|
"baptism-subject-hands-300.png": (535, 690, 730, 900, 3),
|
|
"older-listener-face-300.png": (795, 190, 950, 390, 3),
|
|
"woman-listener-face-300.png": (925, 225, 1060, 425, 3),
|
|
"listener-hands-200.png": (815, 350, 1060, 590, 2),
|
|
"listeners-200.png": (760, 160, 1060, 735, 2),
|
|
"near-background-100.png": (0, 360, 1060, 900, 1),
|
|
"far-background-100.png": (0, 0, 1060, 520, 1),
|
|
"lower-water-100.png": (0, 900, 1060, 1484, 1),
|
|
}
|
|
for name, (left, top, right, bottom, scale) in crops.items():
|
|
crop = candidate.crop((left, top, right, bottom))
|
|
if scale != 1:
|
|
crop = crop.resize(
|
|
(crop.width * scale, crop.height * scale), Image.Resampling.NEAREST
|
|
)
|
|
crop.save(OUT / name)
|
|
|
|
comparison_boxes = [
|
|
(200, 145, 510, 430),
|
|
(500, 500, 725, 740),
|
|
(795, 190, 950, 390),
|
|
(925, 225, 1060, 425),
|
|
]
|
|
font = ImageFont.truetype(str(REPO / "fonts/P052-Bold.otf"), 24)
|
|
rows = []
|
|
for box in comparison_boxes:
|
|
before = parent.crop(box).resize(
|
|
((box[2] - box[0]) * 2, (box[3] - box[1]) * 2),
|
|
Image.Resampling.NEAREST,
|
|
)
|
|
after = candidate.crop(box).resize(before.size, Image.Resampling.NEAREST)
|
|
row = Image.new("RGB", (before.width * 2 + 20, before.height + 50), "#11161c")
|
|
row.paste(before.convert("RGB"), (0, 50))
|
|
row.paste(after.convert("RGB"), (before.width + 20, 50))
|
|
draw = ImageDraw.Draw(row)
|
|
draw.text((10, 10), "Candidate 04", fill="#f4ead4", font=font)
|
|
draw.text((before.width + 30, 10), "Candidate 05", fill="#f4ead4", font=font)
|
|
rows.append(row)
|
|
|
|
sheet = Image.new(
|
|
"RGB",
|
|
(max(row.width for row in rows), sum(row.height for row in rows)),
|
|
"#11161c",
|
|
)
|
|
y = 0
|
|
for row in rows:
|
|
sheet.paste(row, (0, y))
|
|
y += row.height
|
|
sheet.save(OUT / "face-lineage-comparison.png")
|
|
|
|
master = candidate.resize((2000, 2800), Image.Resampling.LANCZOS)
|
|
overlay = Image.open(
|
|
REPO / "artifacts/layers/rare/v3/exports/overlay-normal-2000.png"
|
|
).convert("RGBA")
|
|
Image.alpha_composite(master, overlay).resize(
|
|
(1000, 1400), Image.Resampling.LANCZOS
|
|
).save(OUT / "layout-guide-normal.png")
|
|
|
|
print(f"Wrote candidate 05 review evidence to {OUT}")
|