Project_WL/AgentScripts/WL816b_sheet.py

90 lines
3.0 KiB
Python
Raw Normal View History

# WL-816b 비교 시트 — 인게임 Play 렌더(게임 크기)를 니어리스트로 확대해 붙인다.
# python AgentScripts/WL816b_sheet.py
import os
import numpy as np
from PIL import Image, ImageDraw
RAW = "Screenshots_WL/WL816b/raw/"
OUT = "Screenshots_WL/WL816b/"
WEAPONS = ["Elven_Sword_01", "PP_Theme_10_Mace_003", "PP_Theme_10_Shield_003",
"PP_Theme_08_Mace_003", "PP_Theme_08_Shield_003",
"PP_Theme_05_Bow_003", "PP_Theme_05_Bow_004",
"PP_Theme_03_Scepter_001", "PP_Theme_03_Wand_001", "Dagger1", "Dagger2"]
def load(p):
return Image.open(RAW + p).convert("RGB")
def bbox_of(mask_png, pad=6):
a = np.asarray(Image.open(RAW + mask_png).convert("L"))
ys, xs = np.nonzero(a > 127)
if len(ys) == 0:
return None
return (max(0, xs.min() - pad), max(0, ys.min() - pad), min(a.shape[1], xs.max() + 1 + pad), min(a.shape[0], ys.max() + 1 + pad))
def crop_zoom(img, box, z):
c = img.crop(box)
return c.resize((c.width * z, c.height * z), Image.NEAREST)
def label(im, text, h=22):
out = Image.new("RGB", (im.width, im.height + h), (18, 18, 22))
out.paste(im, (0, h))
ImageDraw.Draw(out).text((4, 5), text, fill=(235, 235, 235))
return out
def hstack(ims, gap=10, bg=(18, 18, 22)):
w = sum(i.width for i in ims) + gap * (len(ims) - 1)
h = max(i.height for i in ims)
out = Image.new("RGB", (w, h), bg)
x = 0
for i in ims:
out.paste(i, (x, 0)); x += i.width + gap
return out
def vstack(ims, gap=10, bg=(18, 18, 22)):
w = max(i.width for i in ims)
h = sum(i.height for i in ims) + gap * (len(ims) - 1)
out = Image.new("RGB", (w, h), bg)
y = 0
for i in ims:
out.paste(i, (0, y)); y += i.height + gap
return out
# ⓒ 전신 좌우 비교 (게임 크기 · 4배)
rows = []
for tag, a, b in [("기본 클래스 10501 (둔기+방패)", "a_full_before.png", "b_full_after.png"),
("한손검 10101 (Elven_Sword_01)", "a_sword_before.png", "b_sword_after.png")]:
ia, ib = load(a), load(b)
box = (470, 880, 620, 1030)
rows.append(label(hstack([label(crop_zoom(ia, box, 4), "지금"), label(crop_zoom(ib, box, 4), "적용 후")]), tag))
vstack(rows).save(OUT + "c_compare_full.png")
# ⓓ 무기 근접 확대 비교 (무기 마스크 bbox · 8배)
cells = []
for w in WEAPONS:
mp = "v_%s_maskA.png" % w
if not os.path.exists(RAW + mp):
continue
box = bbox_of(mp)
if box is None:
continue
a = crop_zoom(load("v_%s_A.png" % w), box, 8)
b = crop_zoom(load("v_%s_B.png" % w), box, 8)
cells.append(label(hstack([label(a, "지금"), label(b, "적용 후")]), w))
# 3열로 접기
cols = [[], [], []]
for i, c in enumerate(cells):
cols[i % 3].append(c)
hstack([vstack(c) for c in cols if c]).save(OUT + "d_compare_weapons.png")
# ⓐⓑ 원본 크기 전신
load("a_full_before.png").save(OUT + "a_before_full.png")
load("b_full_after.png").save(OUT + "b_after_full.png")
print("sheets ->", OUT)