
    KiW7                     h   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 ej                  j                  d e ee      j"                               ddlZdZdZdZd	ZeZd
ZdZeZdZdZd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)u  컨셉 #49 Spikes Asia Trust & Protection Modern Asia
T.O.P 리크루팅 Meta Ad — 매출 1,863% 성장 데이터 앵글
Inspired by Spikes Asia finance/insurance category award winners:
  - ACKO Insurance "Acko Tailor" (personalised insurance)
  - Suncorp "Haven" (market disruption)
    N)Path)sync_playwright)WORKSPACE_ROOT
CTA_MIN_PXSUBHEAD_MIN_PX          $   *   4   X      gffffff?g      ?g      ?   z:output/meta-ads/concept-catalog/49-spikes-trust-protectionzbg.jpgz
sample.pngz49-spikes-trust-protection.pngz0https://generativelanguage.googleapis.com/v1betaa>  Professional financial data visualization background, deep navy blue (#003366) and forest green (#2D7A6E) color palette, abstract upward-trending chart lines and data graph elements, subtle glowing grid lines forming a financial dashboard aesthetic, very thin luminous lines showing exponential growth curves rising from bottom-left to upper-right, warm amber/gold (#FFB81C) accent lines for key trend indicators, dark deep blue background (90% darkness, very deep navy), green geometric shapes and data points scattered elegantly, cinematic lighting, professional financial services editorial photography aesthetic, inspired by Spikes Asia award-winning insurance campaign visuals, modern Asia trust and protection theme, clean minimalist data-driven composition, no text, no numbers, no watermarks, square 1:1 format 1080x1080pxu:  <!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+Sans+KR:wght@400;500;700;900&family=Noto+Serif+KR:wght@700;900&display=swap" rel="stylesheet">
<style>
  @font-face {
    font-family: 'Pretendard';
    src: local('Pretendard-Black');
    font-weight: 900;
  }
  @font-face {
    font-family: 'Pretendard';
    src: local('Pretendard-Bold');
    font-weight: 700;
  }
  @font-face {
    font-family: 'Pretendard';
    src: local('Pretendard-Medium');
    font-weight: 500;
  }
  @font-face {
    font-family: 'Pretendard';
    src: local('Pretendard-Regular');
    font-weight: 400;
  }

  * { margin: 0; padding: 0; box-sizing: border-box; }

  body {
    width: 1080px;
    height: 1080px;
    overflow: hidden;
    background-color: #001A33;
    font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
  }

  .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(
      160deg,
      rgba(0, 20, 51, 0.88) 0%,
      rgba(0, 30, 60, 0.75) 30%,
      rgba(0, 40, 60, 0.65) 55%,
      rgba(0, 20, 40, 0.90) 80%,
      rgba(0, 10, 30, 0.96) 100%
    );
  }

  /* 상단 amber 강조 바 */
  .top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(90deg, #FFB81C 0%, #FF8C00 50%, #2D7A6E 100%);
  }

  /* 좌측 상단 — 브랜드 태그 */
  .brand-tag {
    position: absolute;
    top: 48px;
    left: 64px;
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .brand-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #FFB81C;
    flex-shrink: 0;
  }

  .brand-name {
    font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
    font-size: {_SIZE_32PX}px;
    font-weight: 700;
    color: rgba(255, 184, 28, 0.90);
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  /* 우측 상단 — 카테고리 레이블 */
  .category-label {
    position: absolute;
    top: 50px;
    right: 64px;
    font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
    font-size: {_SIZE_26PX}px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.38);
    letter-spacing: 0.08em;
  }

  /* ── 상단 섹션 — 헤드라인 ───────────────────────────────── */
  .top-section {
    position: absolute;
    top: 120px;
    left: 64px;
    right: 64px;
  }

  /* 서브 카피 (헤드라인 위) */
  .sub-eyebrow {
    font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
    font-size: {_SIZE_36PX}px;
    font-weight: 500;
    color: #2D7A6E;
    letter-spacing: 0.06em;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .sub-eyebrow::before {
    content: '';
    display: inline-block;
    width: 40px;
    height: 3px;
    background: #2D7A6E;
    flex-shrink: 0;
  }

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

  .headline .accent {
    color: #FFB81C;
  }

  /* ── 중앙 섹션 — 핵심 데이터 카드 ──────────────────────── */
  .data-card-section {
    position: absolute;
    top: 400px;
    left: 64px;
    right: 64px;
  }

  /* 성장 수치 히어로 */
  .hero-stat {
    font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
    font-size: {_SIZE_128PX}px;
    font-weight: 900;
    color: #FFB81C;
    line-height: {_LH_1_0};
    letter-spacing: -0.03em;
    display: flex;
    align-items: flex-end;
    gap: 16px;
  }

  .hero-stat .stat-label {
    font-size: {_SIZE_42PX}px;
    font-weight: 700;
    color: rgba(255, 184, 28, 0.75);
    padding-bottom: 16px;
    letter-spacing: -0.01em;
  }

  /* 서브 카피 라인 */
  .sub-copy {
    font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
    font-size: {_SUBHEAD_PX}px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.88);
    line-height: {_LH_1_25};
    letter-spacing: -0.02em;
    margin-top: 16px;
  }

  /* 구분선 */
  .divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, rgba(45, 122, 110, 0.8) 0%, rgba(255, 184, 28, 0.4) 50%, transparent 100%);
    margin: 32px 0;
  }

  /* 조직 성장 데이터 라인 */
  .org-data {
    font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
    font-size: {_SIZE_42PX}px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.82);
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .org-data .arrow-up {
    color: #2D7A6E;
    font-size: {_SIZE_36PX}px;
  }

  .org-data .highlight {
    color: #FFB81C;
  }

  /* ── 하단 CTA 섹션 ───────────────────────────────────────── */
  .cta-section {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 160px;
    background: linear-gradient(135deg, #2D7A6E 0%, #1E5F54 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 64px;
  }

  .cta-text-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .cta-label {
    font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
    font-size: {_SIZE_30PX}px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.65);
    letter-spacing: 0.04em;
  }

  .cta-button-text {
    font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
    font-size: {_SIZE_52PX}px;
    font-weight: 900;
    color: #FFFFFF;
    letter-spacing: -0.01em;
  }

  /* CTA 오른쪽 — 화살표 버튼 */
  .cta-arrow-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #FFB81C;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .cta-arrow-btn span {
    font-size: {_CTA_PX}px;
    color: #003366;
    font-weight: 900;
    line-height: {_LH_1};
  }

  /* 우측 — 트러스트 배지 */
  .trust-badge {
    position: absolute;
    top: 48px;
    right: 64px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }
</style>
</head>
<body>
<div class="container">
  <div class="overlay-gradient"></div>

  <!-- 상단 amber 강조 바 -->
  <div class="top-bar"></div>

  <!-- 브랜드 태그 -->
  <div class="brand-tag">
    <div class="brand-dot"></div>
    <div class="brand-name">T.O.P 사업단</div>
  </div>

  <!-- 카테고리 레이블 -->
  <div class="category-label">META AD</div>

  <!-- 상단: 헤드라인 섹션 -->
  <div class="top-section">
    <div class="sub-eyebrow">성장의 이유가 있습니다</div>
    <div class="headline">매출 <span class="accent">1,863%</span><br>성장의 비결</div>
  </div>

  <!-- 중앙: 데이터 카드 섹션 -->
  <div class="data-card-section">
    <div class="sub-copy">정체된 곳에서<br>시간을 낭비하지 마세요</div>

    <div class="divider"></div>

    <div class="org-data">
      <span class="arrow-up">▲</span>
      T.O.P 사업단&nbsp;
      <span class="highlight">482명 → 5,500명</span>
      &nbsp;폭발적 성장 조직
    </div>
  </div>

  <!-- 하단: CTA -->
  <div class="cta-section">
    <div class="cta-text-block">
      <div class="cta-label">지금 바로 확인하세요</div>
      <div class="cta-button-text">조건 확인하기</div>
    </div>
    <div class="cta-arrow-btn">
      <span>→</span>
    </div>
  </div>

</div>
</body>
</html>
returnc            
         t        d       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 토큰으로 배경 이미지를 생성합니다.u     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] )printgcloud_authget_service_account_token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               O/home/jay/workspace/tools/ai-image-gen/gen_concept49_spikes_trust_protection.pygenerate_backgroundrC     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   0F77	G 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overlay49.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
screenshotr7   SAMPLE_PATHcloser(   )rD   	html_filepbrowserpages        rB   render_htmlr\     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        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_okzA=================================================================u<   컨셉 #49 Spikes Asia Trust & Protection Modern Asia 생성uD   T.O.P 리크루팅 Meta Ad — 매출 1,863% 성장 데이터 앵글u-   
[1/3] 배경 이미지 생성 (Gemini AI)...uR     [경고] 배경 생성 실패. 순수 딥네이비 배경으로 대체합니다.u2   
[2/3] HTML 오버레이 렌더링 (Playwright)...r   rJ    __BG_PATH__u   
[3/3] 복사본 생성...u     복사 완료: u   
완료!z  sample.png : z  named copy : )rN   mkdirr(   rC   r4   existsstatst_sizeHTML_TEMPLATEreplacer\   shutilcopy2rV   	COPY_PATH)okbg_urlhtmls      rB   mainrn     s    TD1	(O	
HI	
PQ	(O	
:;		Bbc	
?@~~GLLN22Q67)$  7D	
'(
LLi(	i[
)*	I	OK=
)*	OI;
'(    __main__)-__doc__r2   rh   syspathlibr   r-   playwright.sync_apir   
gen_configr   r   r   rL   insertr7   __file__parentr)   
_SIZE_26PX
_SIZE_30PX
_SIZE_32PX
_SIZE_36PX_CTA_PX
_SIZE_42PX
_SIZE_52PX_SUBHEAD_PX
_SIZE_88PX_SIZE_128PX_LH_1_15_LH_1_0_LH_1_25_LH_1rN   r4   rV   rj   r+   r,   rf   boolrC   r\   rn   __name__ ro   rB   <module>r      s     
   / A A 3tH~,,- . 








	 ZZ

x
<'99	D$ 
$Up
&T &Rc d  )< zF ro   