Project_WL/AgentScripts/WL816b_sheet2.py

37 lines
1.6 KiB
Python
Raw Normal View History

# WL-816b 후보 육안 비교 시트 — 지금 vs 후보 3안 (무기 근접 8배 · 니어리스트)
import os
import numpy as np
from PIL import Image, ImageDraw
RAW="Screenshots_WL/WL816b/raw/"; OUT="Screenshots_WL/WL816b/"
W=["Elven_Sword_01","PP_Theme_10_Mace_003","PP_Theme_10_Shield_003","PP_Theme_08_Shield_003","PP_Theme_05_Bow_004"]
TAGS=[("before","지금"),("c6p6","c6p6"),("c16p12","c16p12"),("c24p16","c24p16")]
def bbox(p,pad=5):
a=np.asarray(Image.open(RAW+p).convert("L")); ys,xs=np.nonzero(a>127)
if not len(ys): 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 lab(im,t,h=20):
o=Image.new("RGB",(im.width,im.height+h),(18,18,22)); o.paste(im,(0,h))
ImageDraw.Draw(o).text((3,4),t,fill=(235,235,235)); return o
def hs(ims,g=8):
w=sum(i.width for i in ims)+g*(len(ims)-1); h=max(i.height for i in ims)
o=Image.new("RGB",(w,h),(18,18,22)); x=0
for i in ims: o.paste(i,(x,0)); x+=i.width+g
return o
def vs(ims,g=12):
w=max(i.width for i in ims); h=sum(i.height for i in ims)+g*(len(ims)-1)
o=Image.new("RGB",(w,h),(18,18,22)); y=0
for i in ims: o.paste(i,(0,y)); y+=i.height+g
return o
rows=[]
for w in W:
b=bbox("m_%s_before.png"%w)
if b is None: continue
cells=[]
for tg,nm in TAGS:
f=RAW+"s_%s_%s.png"%(w,tg)
if not os.path.exists(f): continue
c=Image.open(f).convert("RGB").crop(b)
cells.append(lab(c.resize((c.width*8,c.height*8),Image.NEAREST),nm))
if cells: rows.append(lab(hs(cells),w))
vs(rows).save(OUT+"e_candidates.png"); print("ok",len(rows))