
    iB                        d Z ddlm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
 e
dz  ZdZdZd	Zd
ZdZddZddZddZedk(  r e        yy)u   A3 Solution 슬라이드용 배경 이미지 생성 스크립트.

포토리얼리스틱 전략 회의실/코칭 세션 이미지를 생성합니다.
상단 딥네이비/차콜 → 하단 웜 크림/골드 색상 전환.
    )annotationsN)Path)WORKSPACE_ROOTz9output/meta-ads/a-group-v6/production/_bg_a3_solution.jpgzgemini-3-pro-image-previewzgemini-3.1-flash-image-previewz0https://generativelanguage.googleapis.com/v1betaz3https://www.googleapis.com/auth/generative-languageu  Photorealistic photograph of a modern premium executive strategy room or one-on-one coaching session. The scene features a high-end corporate interior with sleek dark walls and polished surfaces. Floor-to-ceiling windows on one side allow soft natural light to stream in diagonally, creating a sense of revelation and hope. A large curved monitor or presentation screen in the background displays a clean data dashboard with subtle blue glows. COMPOSITION: The upper two-thirds of the image is clean and uncluttered — deep navy/charcoal gradient at the top, transitioning gradually to warm cream and soft gold tones at the bottom. Minimal objects in the central area to allow text overlay. LIGHTING: Volumetric natural light from one side window, creating god-rays effect. Warm rim lighting from the bottom. Dark moody upper atmosphere with gradual brightening downward. COLOR PALETTE: Top — deep navy #1a1f3a, charcoal #2c2c3e. Bottom — warm cream #f5f0e8, soft gold #c8a96e. The overall gradient feels like dawn breaking in a premium space. MOOD: The moment of discovery — 'I didn't know this existed.' Hopeful turning point, strategic clarity, premium intelligence. CAMERA: Shot on Phase One IQ4 150MP, 35mm wide-angle lens, f/2.8. Shallow depth of field on background elements. STYLE: Apple product launch keynote stage aesthetic. No stock photo feel. No watermarks, no text, no icons, no circuit boards, no tech graphics, no HUD elements. Pure photorealistic interior photography. ASPECT: 1:1 square, 1080x1080px.c                 l    t        j                  g dddd      } | j                  j                         S )N)gcloudauthzprint-access-tokenz<--scopes=https://www.googleapis.com/auth/generative-languageT)capture_outputtextcheck)
subprocessrunstdoutstrip)results    V/home/jay/workspace/.worktrees/task-2116-dev1/tools/ai-image-gen/gen_bg_a3_solution.py	get_tokenr   /   s2    ^^	I$dF
 ==      c                    t          d| d}d|  dd}ddt        igigdd	gd
dd}t        j                  |||d      S )Nz/models/z:generateContentzBearer zapplication/json)AuthorizationzContent-Typepartsr
   IMAGETEXTg      ?)responseModalitiestemperature)contentsgenerationConfig   )headersjsontimeout)GEMINI_API_BASEPROMPTrequestspost)tokenmodel_idurlr   payloads        r   call_geminir)   8   sm    XhZ/?
@C"5'**G
  0123#*F"3
G ==gGSIIr   c                    t         j                  j                  dd       t        d       	 t	               } t        dt        |        d       t        d	t         d       t         t              }|j                  d
v r/t        d|j                   dt                t        | t              }|j                  sMt        d|j                   d|j                  d d  t        j                         t        j                  d       |j!                         }|j#                  dg       }|s?t        dt%        |      d d  t        j                         t        j                  d       |d   j#                  di       j#                  dg       }t'        d |D        d       }|Z|D cg c]  }d|v s|j#                  dd       }}t        d|d d  t        j                         t        j                  d       |d   j#                  dd      }	t)        j*                  |d   d         }
t         }|j-                  |
       |j/                         j0                  }t        d|        t        d |d!d"       t        d#|	        y # t        $ r>}t        d| t        j                         t        j                  d       Y d }~d }~ww xY wc c}w )$NT)parentsexist_oku   gcloud 토큰 획득 중...u   토큰 획득 성공 (길이: )u   토큰 획득 실패: )file   u(   이미지 생성 요청 중... (모델: )i  i  u   Pro 모델 접근 실패 (HTTP z). Fallback: u   API 오류: z - i  
candidatesu   candidates 없음: i,  r   contentr   c              3  *   K   | ]  }d |v s|  yw)
inlineDataN ).0ps     r   	<genexpr>zmain.<locals>.<genexpr>e   s     =Q<1+<q=s   	r
    u'   이미지 데이터 없음. 텍스트:    r3   mimeTypez
image/jpegdatau   저장 완료: u   파일 크기: ,z byteszMIME: )OUTPUT_PATHparentmkdirprintr   len	ExceptionsysstderrexitMODEL_IDr)   status_codeFALLBACK_MODEL_IDokr
   r   getstrnextbase64	b64decodewrite_bytesstatst_size)r%   eresponser;   r0   r   
image_partr6   
text_parts	mime_typeimage_bytesoutput_path	file_sizes                r   mainrZ   H   sz   TD9	
'(.s5zl!<=
 
4XJa
@A5(+Hz)/0D0D/E]SdRefgu&78;;X112#hmmDS6I5JKRUR\R\]==?D,+J#CIdsO#45CJJGqMi,00"=E=%=tDJ16FA&A+aeeFB'F
F7
2A7GHszzZ<(,,ZFI"":l#;F#CDK KK(  "**I	OK=
)*	OIa=
/0	F9+
O  &qc*<2 Gs#   "J *	K4K	K3KK__main__)returnrK   )r%   rK   r&   rK   r\   zrequests.Response)r\   None)__doc__
__future__r   rM   r   rC   pathlibr   r#   
gen_configr   r=   rF   rH   r!   GEMINI_SCOPEr"   r   r)   rZ   __name__r4   r   r   <module>rd      sp    #   
   %ZZ'4 DD' 0!J . b zF r   