
    i                     :   d Z ddlZddlZddlmZ ddlZddlmZ ddlm	Z	m
Z
mZmZmZ ej                  j                  d e ee      j$                               ddlZe
ZeZeZdZeZe	dz  Zedz  Zed	z  Zd
ZdZdZdefdZ dedefdZ!d Z"e#dk(  r e"        yy)u=   컨셉 #29 Chanel Style — 럭셔리 절제 이미지 생성    N)Path)sync_playwright)WORKSPACE_ROOT
CTA_MIN_PXHEADLINE_MIN_PXHEAD_SUB_RATIOSUBHEAD_MIN_PXg      ?z/output/meta-ads/concept-catalog/29-chanel-stylezbg.jpgz
sample.pngz0https://generativelanguage.googleapis.com/v1betazPure white minimalist background, extremely clean and empty, subtle warm light gradient from top center creating soft glow, luxury fashion editorial aesthetic, no texture, no objects, vast negative space, no text, no people, square formatu  <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
  * { margin: 0; padding: 0; box-sizing: border-box; }
  body {
    width: 1080px;
    height: 1080px;
    overflow: hidden;
    font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
    background-color: #FFFFFF;
  }
  .container {
    position: relative;
    width: 1080px;
    height: 1080px;
    background-image: url('__BG_PATH__');
    background-size: cover;
    background-position: center;
  }

  /* 극단적 여백: 상 40% : 콘텐츠 20% : 하 40% */
  .center-block {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 840px;
    text-align: center;
  }

  /* 핵심 헤드라인 — Noto Serif KR / Playfair Display 느낌 */
  .headline {
    font-size: {_HEADLINE_PX}px;
    font-weight: 200;
    color: #0D0D0D;
    line-height: {_LH_1_25};
    letter-spacing: -0.02em;
    font-family: 'Noto Serif KR', 'Pretendard', serif;
    margin-bottom: 52px;
  }

  /* 0.5px 수평선 */
  .divider {
    width: 100%;
    height: 0.5px;
    background: #0D0D0D;
    margin-bottom: 52px;
  }

  /* 보조 — 골드 올캡스 넓은 letter-spacing */
  .sub-text {
    font-size: {_SUBHEAD_PX}px;
    font-weight: 200;
    color: #C9A84C;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    line-height: {_LH_RATIO};
    margin-bottom: 72px;
  }

  /* CTA — 블랙 올캡스, 넓은 letter-spacing */
  .cta {
    font-size: {_CTA_PX}px;
    font-weight: 300;
    color: #0D0D0D;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    display: inline-block;
    border-bottom: 0.5px solid #0D0D0D;
    padding-bottom: 6px;
  }

  /* 상단 브랜드 워터마크 */
  .top-mark {
    position: absolute;
    top: 56px;
    left: 50%;
    transform: translateX(-50%);
    font-size: {_CTA_PX}px;
    font-weight: 200;
    color: #BFBFBF;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    white-space: nowrap;
  }

  /* 하단 미세 텍스트 */
  .bottom-note {
    position: absolute;
    bottom: 52px;
    left: 50%;
    transform: translateX(-50%);
    font-size: {_CTA_PX}px;
    font-weight: 200;
    color: #C0C0C0;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    white-space: nowrap;
  }

  /* 좌측 세로 골드 장식선 */
  .gold-line-left {
    position: absolute;
    left: 72px;
    top: 200px;
    bottom: 200px;
    width: 0.5px;
    background: linear-gradient(to bottom, transparent, #C9A84C 30%, #C9A84C 70%, transparent);
  }

  /* 우측 세로 골드 장식선 */
  .gold-line-right {
    position: absolute;
    right: 72px;
    top: 200px;
    bottom: 200px;
    width: 0.5px;
    background: linear-gradient(to bottom, transparent, #C9A84C 30%, #C9A84C 70%, transparent);
  }
</style>
</head>
<body>
<div class="container">
  <div class="top-mark">Prestige Career</div>
  <div class="gold-line-left"></div>
  <div class="gold-line-right"></div>
  <div class="center-block">
    <div class="headline">열심히는 하는데,<br>월급은 제자리걸음?</div>
    <div class="divider"></div>
    <div class="sub-text">당신의 가치는 다릅니다</div>
    <div class="cta">확인하기</div>
  </div>
  <div class="bottom-note">2026 · Career Design</div>
</div>
</body>
</html>
returnc            	         t        j                  d      } | st        d       yd|  dd}t         d}dd	t        igigd
ddgid}t        d       t        j                  |||d      }|j                  dk7  r)t        d|j                   d|j                  dd         y|j                         }|j                  di g      d   j                  di       j                  dg       D ]X  }d|v st        j                  |d   d         }t        j                  |       t        dt         dt        |      dd        y |j                  di g      d   j                  d d!      }t        d"| d#       y)$u;   Gemini SA 토큰으로 배경 이미지를 생성합니다.z3https://www.googleapis.com/auth/generative-languageu     [오류] SA 토큰 없음FzBearer zapplication/json)AuthorizationzContent-Typez6/models/gemini-3.1-flash-image-preview:generateContentpartstextresponseModalitiesTEXTIMAGE)contentsgenerationConfigu     배경 생성 요청 중...x   )headersjsontimeout   u     [오류] z: Ni,  
candidatesr   content
inlineDatadatau     배경 저장 완료: z (,z bytes)TfinishReason?u2     [오류] 이미지 파트 없음 (finishReason: ))gcloud_authget_service_account_tokenprintGEMINI_API_BASE	BG_PROMPTrequestspoststatus_coder   r   getbase64	b64decodeBG_PATHwrite_byteslen)	sa_tokenr   urlpayloadrespr   part	img_bytesreasons	            X/home/jay/workspace/.worktrees/task-2116-dev1/tools/ai-image-gen/gen_concept29_chanel.pygenerate_backgroundr7      s   445jkH+,")( 4FXYGS
TC 34561FG3DEG 

)*==gGSID3D,,-R		$3/@AB99;Dt,Q/33IrBFFwPRS 4((l);F)CDI	*,WIRIq7IQR XXlRD)!,00EF	>vha
HI    html_contentc                    t         dz  }|j                  | d       t               5 }|j                  j	                         }|j                  ddd      }|j                  d|        |j                  d       |j                  t        t              d	
       |j                          ddd       t        dt                y# 1 sw Y   xY w)u-   Playwright로 HTML을 PNG로 캡처합니다.zoverlay.htmlzutf-8)encodingi8  )widthheight)viewportfile://i  png)pathtypeNu     PNG 저장 완료: T)
OUTPUT_DIR
write_textr   chromiumlaunchnew_pagegotowait_for_timeout
screenshotstrSAMPLE_PATHcloser#   )r9   	html_filepbrowserpages        r6   render_htmlrR      s    ^+I8		 a**##%44)HI		GI;'(d#S-E: 
!+
/0 s   BCCc                     t         j                  dd       t        d       t               } | st	        j
                  d       t        d       dt         }t        j                  d|      }t        |       t        dt                y )	NT)parentsexist_oku    [1/2] 배경 이미지 생성...   u$   [2/2] HTML 오버레이 렌더링...r?   __BG_PATH__u	   
완료: )rC   mkdirr#   r7   sysexitr,   HTML_TEMPLATEreplacerR   rL   )okbg_urlhtmls      r6   mainr`      sr    TD1	
,-		B	
01wi F  7D	J{m
$%r8   __main__)$__doc__r*   rY   pathlibr   r&   playwright.sync_apir   
gen_configr   r   r   r   r	   rA   insertrK   __file__parentr!   _CTA_PX_SUBHEAD_PX_HEADLINE_PX_LH_1_25	_LH_RATIOrC   r,   rL   r$   r%   r[   boolr7   rR   r`   __name__ r8   r6   <module>rq      s    C  
   / b b 3tH~,,- . 
	 OO

x
<'D= 
JZT :c d & zF r8   