
    (<iI%                     X   d Z ddl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dZeZeZeZeZdZdZd	Ze
d
z  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)uW   컨셉 #45 Finance Luxury Frame — Robinhood Visual System (One Show 2025 Gold Pencil)    N)Path)sync_playwright)WORKSPACE_ROOTCORE_METRIC_MIN_PX
CTA_MIN_PXHEADLINE_MIN_PXSUBHEAD_MIN_PX   g      ?g?g333333?z9output/meta-ads/concept-catalog/45-oneshow-finance-luxuryzbg.jpgz
sample.pngz45-finance-luxury-frame.pngz0https://generativelanguage.googleapis.com/v1betaaS  Extreme macro close-up of a luxury business suit lapel and business card, very dark luxury editorial photography, deep charcoal black fabric texture, fine wool weave visible up close, a crisp matte white business card resting against the lapel, dramatic low-key lighting with single rim light from side, 95% of the frame is deep shadow, only fabric texture catches faint light, ultra shallow depth of field, bokeh background, average brightness 20-25%, shot on Hasselblad H6D with 120mm macro lens, luxury fashion editorial, Robinhood rebrand aesthetic, no text, no watermarks, square 1:1 formatux  <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Serif+KR:wght@400;700;900&family=Noto+Sans+KR:wght@400;700;900&display=swap" rel="stylesheet">
<style>
  * { margin: 0; padding: 0; box-sizing: border-box; }
  body {
    width: 1080px;
    height: 1080px;
    overflow: hidden;
    background-color: #0A0A0A;
  }
  .container {
    position: relative;
    width: 1080px;
    height: 1080px;
    background-image: url('__BG_PATH__');
    background-size: cover;
    background-position: center;
  }

  /* 상단→하단 반투명 검정 그라디언트 오버레이 */
  .overlay-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.72) 0%,
      rgba(0, 0, 0, 0.45) 35%,
      rgba(0, 0, 0, 0.25) 55%,
      rgba(0, 0, 0, 0.78) 80%,
      rgba(0, 0, 0, 0.92) 100%
    );
  }

  /* 상단 1/3 — 메인 헤드라인 영역 */
  .top-block {
    position: absolute;
    top: 80px;
    left: 72px;
    right: 72px;
  }

  /* 메인 헤드라인 */
  .headline {
    font-family: 'Noto Serif KR', 'Pretendard', 'Noto Sans KR', serif;
    font-size: {_HEADLINE_PX}px;
    font-weight: 700;
    color: #FFFFFF;
    line-height: {_LH_1_25};
    letter-spacing: -0.02em;
  }

  /* 중앙 — 액센트 숫자 블록 */
  .center-block {
    position: absolute;
    top: 50%;
    left: 72px;
    right: 72px;
    transform: translateY(-50%);
  }

  /* 액센트 넘버 — 단 하나의 컬러 */
  .accent-number {
    font-family: 'Noto Sans KR', 'Pretendard', sans-serif;
    font-size: {_METRIC_PX}px;
    font-weight: 900;
    color: #39FF14;
    line-height: {_LH_1_1};
    letter-spacing: -0.03em;
    display: block;
  }

  /* 서브 텍스트 */
  .sub-text {
    font-family: 'Noto Sans KR', 'Pretendard', sans-serif;
    font-size: {_SUBHEAD_PX}px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.70);
    line-height: {_LH_1_2};
    letter-spacing: -0.01em;
    margin-top: 12px;
  }

  /* 하단 CTA 블록 */
  .bottom-block {
    position: absolute;
    bottom: 72px;
    left: 72px;
    right: 72px;
  }

  /* 얇은 흰색 구분선 */
  .divider {
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.25);
    margin-bottom: 28px;
  }

  /* CTA 텍스트 */
  .cta-text {
    font-family: 'Noto Sans KR', 'Pretendard', sans-serif;
    font-size: {_CTA_PX}px;
    font-weight: 400;
    color: #FFFFFF;
    letter-spacing: 0.04em;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .cta-brand {
    font-weight: 700;
  }

  /* 화살표 화살표 아이콘 */
  .cta-arrow {
    font-size: {_CTA_PX}px;
    color: #39FF14;
  }

  /* 좌측 하단 태그 */
  .tag {
    position: absolute;
    top: 80px;
    right: 72px;
    font-family: 'Noto Sans KR', 'Pretendard', sans-serif;
    font-size: {_SIZE_28PX}px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
</style>
</head>
<body>
<div class="container">
  <div class="overlay-gradient"></div>

  <!-- 태그 -->
  <div class="tag">T.O.P 사업단</div>

  <!-- 상단 헤드라인 -->
  <div class="top-block">
    <div class="headline">열심히는 하는데,<br>월급은 제자리걸음?</div>
  </div>

  <!-- 중앙 액센트 넘버 + 서브 -->
  <div class="center-block">
    <span class="accent-number">최대 1,000만원</span>
    <div class="sub-text">신입 정착지원금</div>
  </div>

  <!-- 하단 CTA -->
  <div class="bottom-block">
    <div class="divider"></div>
    <div class="cta-text">
      <span><span class="cta-brand">T.O.P 사업단</span> &nbsp;|&nbsp; 지금 상담 신청하기</span>
      <span class="cta-arrow">→</span>
    </div>
  </div>
</div>
</body>
</html>
returnc            
         t        j                  d      } | st        d       yd|  dd}g d}|D ]u  }t         d| d	}d
dt        igigdddgid}t        d| d       	 t        j                  |||d      }|j                  dk(  r|j                         }|j                  di g      d   j                  di       j                  d
g       D ]Y  }	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       t        d$t!        |      dd%         Nt        d&|j                   d'|j"                  dd         x y# t        $ r}t        d|        Y d}~d}~ww xY w)(u;   Gemini SA 토큰으로 배경 이미지를 생성합니다.z3https://www.googleapis.com/auth/generative-languageu     [오류] SA 토큰 없음FzBearer zapplication/json)AuthorizationzContent-Type)z)gemini-2.0-flash-preview-image-generationzgemini-3.1-flash-image-previewzgemini-3-pro-image-previewz/models/z:generateContentpartstextresponseModalitiesTEXTIMAGE)contentsgenerationConfigu'     배경 생성 요청 중... (모델: )x   )headersjsontimeoutu     [오류] 연결 실패: N   
candidatesr   content
inlineDatadatau     배경 저장 완료: z (,z bytes)TfinishReason?u2     [오류] 이미지 파트 없음 (finishReason: u
     응답: i,  z  [HTTP z] )gcloud_authget_service_account_tokenprintGEMINI_API_BASE	BG_PROMPTrequestspost	Exceptionstatus_coder   getbase64	b64decodeBG_PATHwrite_byteslenstrr   )sa_tokenr   models_to_trymodelurlpayloadresper   part	img_bytesreasons               `/home/jay/workspace/.worktrees/task-2057-dev2/tools/ai-image-gen/gen_concept45_finance_luxury.pygenerate_backgroundr=      s   445jkH+,")( 4FXYGM
  D !%0@A!VY$7#89:!57H I
 	7wa@A	==gGSQD s"99;Dt4Q7;;IrJNNwXZ[  4' & 0 0l1CF1K LI''	24WIRIq?QQXYZ  XXlRD1!488MFFvhaPQJs4y#/01HT--.b4C0ABC1D2 !  	.qc23	s   %F,,	G5G		G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overlay45.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
screenshotr1   SAMPLE_PATHcloser$   )r>   	html_filepbrowserpages        r<   render_htmlrV     s    --I8		 a**##%44)HI		GI;'(d#S-E: 
!+
/0 s   BCCc                     t         j                  dd       t        d       t        d       t        d       t        d       t        d       t               } | s t        d       t        j                  d       t        d	       t        j                         r+t        j                         j                  d
kD  r
dt         }nd}t        j                  d|      }t        |       t        d       t        j                  t        t               t        dt                t        d       t        dt                t        dt                y )NT)parentsexist_okz<============================================================u&   컨셉 #45 Finance Luxury Frame 생성z8Inspired by Robinhood Visual System (One Show 2025 Gold)u-   
[1/3] 배경 이미지 생성 (Gemini AI)...uL     [경고] 배경 생성 실패. 순수 검정 배경으로 대체합니다.    u2   
[2/3] HTML 오버레이 렌더링 (Playwright)...r   rD    __BG_PATH__u   
[3/3] 복사본 생성...u     복사 완료: u   
완료!z  sample.png : z  named copy : )rH   mkdirr$   r=   r.   r/   existsstatst_sizeHTML_TEMPLATEreplacerV   shutilcopy2rP   	COPY_PATH)okbg_urlhtmls      r<   mainri     s    TD1	(O	
23	
DE	(O	
:;		B\]C 	
?@~~GLLN22Q67)$  7D	
'(
LLi(	i[
)*	I	OK=
)*	OI;
'(rZ   __main__))__doc__r,   rc   syspathlibr   r'   playwright.sync_apir   
gen_configr   r   r   r   r	   rF   insertr1   __file__parentr"   
_SIZE_28PX_CTA_PX_SUBHEAD_PX_HEADLINE_PX
_METRIC_PX_LH_1_25_LH_1_1_LH_1_2rH   r.   rP   re   r%   r&   ra   boolr=   rV   ri   __name__ rZ   r<   <module>r~      s    ]   
   / f f 3tH~,,- . 




 YY

x
<'66	D
0 
hV&T &Rc d  )@ zF rZ   