
    (<i                      d   d Z ddlZddlZddlZddlmZ ddlZej                  j                  d e	 ee
      j                               ddlZddlmZmZmZmZ dZeZeZeZdZdZedz  Z ed	      Zd
Zde de de de de de dZde	de	defdZdede	deddfdZd Ze dk(  r e        yy)uG   컨셉 #30 — 아르티장 오렌지 (Hermès Style) 이미지 생성.    N)Path)
CTA_MIN_PXHEADLINE_MIN_PXSUBHEAD_MIN_PXWORKSPACE_ROOT   gzG?g      ?z:output/meta-ads/concept-catalog/30-hermes-style/sample.pngz/tmp/concept30_overlay.htmlu?  Warm ivory artisan background, delicate hand-drawn style orange line art illustration on the right side showing abstract flowing ribbon and elegant curves, fine paper texture, warm ambient lighting, Hermès-inspired artistic aesthetic, no text, no words, no letters, analog illustration quality, 1080x1080 square formatu  <!DOCTYPE html>
<html lang="ko">
<head>
  <meta charset="UTF-8"/>
  <meta name="viewport" content="width=1080"/>
  <title>Concept 30 - Hermes Style</title>
  <style>
    @import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400;1,600;1,700&family=Noto+Serif+KR:wght@300;400;600&display=swap');

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

    html, body {
      width: 1080px;
      height: 1080px;
      overflow: hidden;
      -webkit-font-smoothing: antialiased;
    }

    body {
      position: relative;
      background: #FAF3E8;
    }

    #bg-layer {
      position: absolute;
      inset: 0;
      z-index: 0;
      background-image: url('{bg_url}');
      background-size: cover;
      background-position: center center;
      background-repeat: no-repeat;
    }

    /* 좌측 아이보리 반투명 패널 */
    .left-panel {
      position: absolute;
      top: 0;
      left: 0;
      width: 580px;
      height: 1080px;
      z-index: 2;
      background: linear-gradient(
        90deg,
        rgba(250, 243, 232, 0.96) 0%,
        rgba(250, 243, 232, 0.85) 80%,
        rgba(250, 243, 232, 0) 100%
      );
    }

    /* 텍스트 영역 */
    .text-zone {
      position: absolute;
      top: 0;
      left: 0;
      width: 540px;
      height: 1080px;
      z-index: 3;
      padding: 100px 60px 80px 72px;
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
    }

    /* 장식 라인 */
    .deco-line {
      width: 48px;
      height: 2px;
      background-color: #E8611A;
      margin-bottom: 36px;
    }

    /* 핵심 메시지 */
    .headline {
      font-family: 'Cormorant Garamond', 'Noto Serif KR', 'Nanum Myeongjo', serif;
      font-size: zIpx;
      font-weight: 600;
      font-style: italic;
      line-height: u   ;
      color: #2C1810;
      letter-spacing: -0.02em;
      white-space: pre-line;
      margin-bottom: 44px;
    }

    /* 서브 카피 */
    .subtext {
      font-family: 'Cormorant Garamond', 'Noto Serif KR', serif;
      font-size: zIpx;
      font-weight: 300;
      font-style: normal;
      line-height: uz  ;
      color: #A0784A;
      letter-spacing: -0.01em;
      margin-bottom: auto;
    }

    /* 하단 장식선 */
    .bottom-deco {
      width: 100%;
      height: 1px;
      background: linear-gradient(90deg, #A0784A, transparent);
      margin-bottom: 32px;
    }

    /* CTA */
    .cta {
      font-family: 'Cormorant Garamond', 'Noto Serif KR', serif;
      font-size: u  px;
      font-weight: 400;
      color: #2C1810;
      text-decoration: underline;
      text-underline-offset: 6px;
      text-decoration-color: #E8611A;
      letter-spacing: 0.02em;
    }

    /* 우측 하단 브랜드 태그 */
    .brand-tag {
      position: absolute;
      bottom: 48px;
      right: 60px;
      z-index: 4;
      font-family: 'Cormorant Garamond', serif;
      font-size: uQ  px;
      font-weight: 300;
      letter-spacing: 0.18em;
      color: #A0784A;
      text-transform: uppercase;
    }
  </style>
</head>
<body>
  <div id="bg-layer"></div>
  <div class="left-panel"></div>
  <div class="text-zone">
    <div class="deco-line"></div>
    <div class="headline">열심히는 하는데,&#10;월급은 제자리걸음?</div>
    <div class="subtext">당신의 노력에 맞는&#10;무대가 필요합니다</div>
    <div class="bottom-deco"></div>
    <div class="cta">확인하기 →</div>
  </div>
  <div class="brand-tag">Career · Growth</div>
</body>
</html>tokenpromptreturnc                 <   g d}d|  dd}dd|igigddd	gid
}d}|D ]  }d| d}t        d| d       t        j                         }	 t        j                  |||d      }	|	j                  dv r&t        d|	j                   d       |	j                  }z|	j                          t        j                         |z
  }
t        d|
dd        n t        d|       |	j                         }|j                  dg       }|st        dt        |      dd        |d   j                  di       j                  dg       D ]#  }d|v st        j                  |d   d         c S  t        d       # t        $ r}|}t        d| d       Y d}~vd}~ww xY w)!u&   Gemini API로 배경 이미지 생성.)zgemini-3-pro-image-previewzgemini-3.1-flash-image-previewzgemini-2.5-flash-imagezBearer zapplication/json)AuthorizationzContent-TypepartstextresponseModalitiesIMAGETEXT)contentsgenerationConfigNz8https://generativelanguage.googleapis.com/v1beta/models/z:generateContentu0     [Gemini] 배경 이미지 생성 중 (모델: z)...i,  )headersjsontimeout)i  i  z  [Gemini] u    — 다음 모델 시도...u     [Gemini] 완료 (z.1fu   초)u     [Gemini] 오류: u(   모든 모델 실패. 마지막 오류: 
candidateszNo candidates: r   content
inlineDatadatau.   이미지 데이터가 응답에 없습니다.)printtimerequestspoststatus_coderaise_for_status	ExceptionRuntimeErrorr   getstrbase64	b64decode)r	   r
   	model_idsr   payloadlast_errmodel_idurlstartrespelapseder   r   parts                  X/home/jay/workspace/.worktrees/task-2057-dev2/tools/ai-image-gen/gen_concept30_hermes.pygenerate_bg_imager3      s   I #5'**G
  01231GV3DEG
 H RH
Rbc@
$OP			==gGSQD:-D$4$4#55QRS++!!#iikE)G'}D9:R& EhZPQQ99;D,+J_SYt_,=>??1!!)R044WbA @4##D$6v$>??@ G
HH!  	H's*FGH	s   AE67E66	F?FFbg_byteshtml_templateoutput_pathc                    ddl m} ddl}|j                  |       j	                         }d| }|j                  |      }t        j                  |d       t        dt                |j                  j                  d	d	
        |       5 }|j                  j                         }		 |	j                  ddd      }
|
j                  dt         d       |
j                  d       |
j!                  t#        |      d       t        d|        |	j%                          	 ddd       y# |	j%                          w xY w# 1 sw Y   yxY w)u'   HTML + Playwright로 최종 PNG 생성.r   )sync_playwrightNzdata:image/jpeg;base64,)bg_urlzutf-8)encodingu     [HTML] 템플릿 저장: T)parentsexist_oki8  )widthheight)viewportzfile://networkidle)
wait_untili  png)pathtypeu     [PNG] 저장 완료: )playwright.sync_apir8   r&   	b64encodedecodeformat	HTML_PATH
write_textr   parentmkdirchromiumlaunchnew_pagegotowait_for_timeout
screenshotr%   close)r4   r5   r6   r8   b64bg_b64bg_data_urlhtml_contentpbrowserpages              r2   render_html_to_pngr[      s-   3 ]]8$++-F+F84K ''{';L8	'	{
34TD9		 	a**##%	##tt-L#MDII	{+IF!!$'OO[!1O>+K=9:MMO	 	 MMO	 	s%   E*A*D.E.E  EEc                     t        d       t        d       t        j                  d      } t        dt        |        d       t        d       t	        | t
              }t        dt        |      dd	       t        d
       t        |t        t               t        j                         j                  dz  }t        dt         d|dd       y )NuG   === 컨셉 #30 아르티장 오렌지 (Hermès Style) 생성 시작 ===u%   
[1/3] Gemini 인증 토큰 획득...z3https://www.googleapis.com/auth/generative-languageu      토큰 획득 성공 (길이: u   자)u!   
[2/3] 배경 이미지 생성...u     배경 이미지 크기: ,z bytesu1   
[3/3] HTML 오버레이 합성 및 PNG 저장...i   u   
=== 완료: z (z.0fz KB) ===)r   gcloud_authget_service_account_tokenlenr3   	BG_PROMPTr[   HTML_TEMPLATEOUTPUT_PATHstatst_size)r	   r4   size_kbs      r2   mainrg     s    	
ST	
2311=E 
,SZL
=>	
./ 	2H	'Ha'8
?@	
>?x< ((4/G	N;-r'#h
?@    __main__)!__doc__r&   sysr   pathlibr   r   rC   insertr%   __file__rK   r^   
gen_configr   r   r   r   
_SIZE_24PX_CTA_PX_SUBHEAD_PX_HEADLINE_PX_LH_1_18_LH_1_25rc   rI   ra   rb   bytesr3   r[   rg   __name__ rh   r2   <module>ry      s7   M  
    3tH~,,- .  R R 

 [[./	; 
JT    : 
   : "     wOd/IS /I# /I% /Id s  RV 6A( zF rh   