
    iZ                         d Z ddlZddlZddlZddlZddlZej                  j                  dd       ddlZdZ	d Z
d Zedk(  r e        yy)u@   슬라이드 3 (해결책 제시) 이미지 생성 스크립트.    Nz&/home/jay/workspace/tools/ai-image-genun
  Create a vertical card news slide image (portrait orientation, 4:5 ratio) for a Korean insurance sales team recruiting campaign — Slide 3: Solution Reveal.

SCENE: A confident Korean professional (insurance consultant, 30s, wearing smart business casual — dark navy blazer over light shirt) stands at the center-foreground, facing slightly left with a bright smile and confident posture. Behind and around them float multiple glowing digital screens, holographic AI dashboards, smartphone interfaces, tablet UI panels, notification bell icons, and data flow visualizations. The character feels empowered as the technology works autonomously around them. It looks like the systems are doing the selling for them.

VISUAL STYLE: High-quality digital illustration / semi-realistic AI art style. NOT stock photo. Clean, modern Korean webtoon-influenced but polished. Strong cinematic composition.

BACKGROUND: Dark navy (#001133) at the very bottom smoothly transitioning to bright electric blue (#0044CC) in the middle, then to bright cyan/sky blue (#00CCFF) and near-white at the top. Glowing neon light trails. Feels like a sunrise or breakthrough moment — dark-to-bright transition. Volumetric light rays emanating from the upper center.

TEXT ELEMENTS (render these exactly):
1. TOP AREA — Large bold Korean text: 시스템이 대신 팔아주는 곳
   Style: Heavy white bold sans-serif font, with subtle cyan glow/shadow. Very prominent.

2. MIDDLE AREA — Five keyword badge chips in a horizontal row:
   Consulting Logic | Naver Pipeline | AI Automation | Authority Brand | IT Work-Flow
   Style: Glowing pill-shaped badges with white text on semi-transparent dark blue backgrounds.

3. BOTTOM TEXT — Korean subtitle in smaller white text: 5대 AI 영업시스템을 직접 운영

4. BOTTOM RIGHT CORNER — Small branding text: 서울대보험쌤 x 티오피사업단

COLOR PALETTE: Electric blue (#0066FF), bright cyan (#00D4FF), deep navy (#001133), white (#FFFFFF). Glowing neon accents. Tech/AI aesthetic.

LIGHTING: Volumetric god-rays from top center. Subject lit by cool blue-white fill light. Glowing screens cast blue-cyan light on the character's face.

MOOD: Discovery moment, breakthrough solution found, empowering, futuristic, hopeful. The feeling of the system working for you.

COMPOSITION: Rule of thirds. Character in lower-center. Digital elements fill upper area. Text clearly overlaid across zones.

STYLE: Samsung Galaxy / Korean fintech app promotional illustration. Cinematic but clean. No watermarks. No clipart. No stock photo aesthetic.

ASPECT: Tall portrait format (4:5 ratio, 1080x1350 equivalent), optimized for mobile.c                      ddl } | j                  g dddd      }|j                  j                         }|st	        d      |S )u6   generative-language 스코프로 gcloud 토큰 획득.r   N)gcloudauthzprint-access-tokenz<--scopes=https://www.googleapis.com/auth/generative-languageT)capture_outputtextchecku   빈 토큰 반환)
subprocessrunstdoutstripRuntimeError)r	   resulttokens      S/home/jay/workspace/.worktrees/task-2116-dev1/tools/ai-image-gen/generate_slide3.pyget_token_with_scoper   1   sM    ^^	I$d  F
 MM!E.//L    c                     t        d       t               } t        dt        |        d       d}d|  dd}dd	t        igigd
dgddd}t        d       t	        j                         }t        j                  |||d      }t	        j                         |z
  }t        d|dd|j                          |j                  dk7  r.t        d|j                  d d        t        j                  d       |j                         }|j                  dg       }|s-t        dt        |      d d        t        j                  d       |d   j                  di       j                  dg       }	d }
|	D ]
  }d|v s|}
 n |
E|	D cg c]  }d	|v s|j                  d	d       }}t        d|       t        j                  d       |
d   j                  d d!      }t        j                  |
d   d"         }t!        j"                  d#d$%       d&|v rd'}d(}nd)}d(}d*|z   }t%        |d+      5 }|j'                  |       d d d        t         j(                  j+                  |      }t        d,|        t        d-|d.d/|d0z  dd1       t        d2|        ||k7  r)|d'k(  r$dd l}|j/                  ||       t        d3|        |S c c}w # 1 sw Y   xY w)4Nu7   인증 토큰 획득 중 (generative-language scope)...u   토큰 획득 성공: z charszbhttps://generativelanguage.googleapis.com/v1beta/models/gemini-3-pro-image-preview:generateContentzBearer zapplication/json)AuthorizationzContent-Typepartsr   IMAGETEXTg      ?)responseModalitiestemperature)contentsgenerationConfigu4   이미지 생성 요청 중... (약 25-60초 소요)i,  )headersjsontimeoutu   응답 수신: z.1fu   초, 상태코드:    u   오류 응답:i     
candidatesu   candidates 없음:r   content
inlineData u   이미지 없음. 텍스트:mimeTypez
image/jpegdataz&/home/jay/.cokacdir/workspace/7A90EE10T)exist_okjpegz.jpgz:/home/jay/.cokacdir/workspace/7A90EE10/slide3-solution.pngz.pngz6/home/jay/.cokacdir/workspace/7A90EE10/slide3-solutionwbu   저장 완료: u   파일 크기: ,z bytes (i   z KB)u   MIME 타입: u   PNG 경로로도 복사: )printr   lenPROMPTtimerequestspoststatus_coder   sysexitr   getstrbase64	b64decodeosmakedirsopenwritepathgetsizeshutilcopy2)r   urlr   payloadstartresponseelapsedr&   r!   r   
image_partpartp
text_parts	mime_typeimage_bytesexttargetactual_pathfsizer>   s                         r   mainrP   ?   s   	
CD "E	"3u:,f
56
nC"5'**G
  0123#*F"3
G 

@AIIKE}}S'MHiikE!G	OGC=(;H<P<P;Q
RSs"ds 34==?D,+J"CIdsO4qMi,00"=EJ 4J
 16FA&A+aeeFB'F
F,j9<(,,ZFI"":l#;F#CDKKK84H MMJSPK	k4	  A	 77??;'D	OK=
)*	OD88DIc?$
?@	M)
%& f[&))&23C G& s   	KK'KK__main__)__doc__r2   r6   r/   r.   r8   r<   insertgcloud_authr-   r   rP   __name__ r   r   <module>rW      sY    F 
    	 ; <  \ JK\ zF r   