
    i8                        d Z ddlmZ ddl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j                  j                  d e ee      j                                ddlZedz  Zedz  Zedz  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   Concept #44 "Hangul Monument" — One Show 2024 Gold Pencil ADLaM-inspired ad.

Pure typographic advertisement: dark background + monumental Korean letterforms.
Output: 1080x1080px PNG saved to concept-catalog/44-oneshow-hangul-monument/
    )annotationsN)Path)WORKSPACE_ROOTz:output/meta-ads/concept-catalog/44-oneshow-hangul-monumentz
sample.pngz44-hangul-monument.pngzgemini-3-pro-image-previewzgemini-3.1-flash-image-previewz0https://generativelanguage.googleapis.com/v1betau	  Create a 1:1 square format (1080x1080px) premium typographic advertisement poster.

BACKGROUND:
Solid dark charcoal color, almost black — hex #1A1A1A. Perfectly flat, no gradients, no texture. Pure dark void.

MAIN TYPOGRAPHY — THE HERO:
Three large Korean characters: 설 계 사
Each character is a monumental graphic object — rendered in massive, bold weight, approximately 55-60% of the canvas height. The three characters span 80% of the canvas width horizontally, with generous equal spacing between them.
Font style: heavy-weight Korean serif or ultra-bold sans-serif, extremely crisp and precise.
Color: warm cream-gold, approximately #E8D5B5 — like aged ivory or brushed brass.
Letter-spacing: wide, generous — treating each glyph as a sculpture.
The characters are vertically and horizontally centered on the canvas.
Treatment: Each Hangul character has the monumental presence of carved stone or cast gold — think ADLaM script in the Microsoft One Show 2024 campaign, where unfamiliar letterforms became precious art objects through sheer precision.

SECONDARY TEXT:
Below the main characters, centered, smaller:
Korean text: 당신의 다음 챕터
Style: light weight, approximately 1/3 the size of main characters.
Color: warm cream at 60% opacity — semi-transparent.

BOTTOM TEXT:
Near the bottom center:
Korean text: T.O.P 사업단 | 지금 상담 신청하기
Style: thin/light weight, small — approximately 1/5 the size of main characters.
Color: white at 50% opacity — semi-transparent.

LAYOUT RULES:
- Symmetrical vertical whitespace above and below the main character block
- All text elements are horizontally centered
- No decorative elements, no borders, no icons, no photos
- Pure typography — letterforms are the entire visual

STYLE REFERENCE:
- Microsoft ADLaM campaign (One Show 2024, 7x Gold Pencil) — script as prestige
- Luxury brand typographic posters (Céline, The Row, Bottega Veneta editorial)
- Characters treated like Hangul calligraphy elevated to monumental sculpture
- Maximum negative space, maximum typographic impact
- The aesthetic of museum-quality typography exhibitions

MOOD: Monumental. Prestigious. Silent power. The letterforms speak volumes through their sheer physical beauty and scale.

OUTPUT: Square 1:1 format PNG, 1080x1080px equivalent. No watermark.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partstextIMAGETEXTg      ?)responseModalitiestemperature)contentsgenerationConfig,  )headersjsontimeout)GEMINI_API_BASEPROMPTrequestspost)tokenmodelurlr   payloads        a/home/jay/workspace/.worktrees/task-2116-dev1/tools/ai-image-gen/gen_concept44_hangul_monument.pycall_geminir   R   sm    XeW,<
=C"5'**G
  0123#*F"3
G ==gGSII    c                   | j                         }|j                  dg       }|st        dt        |      d d        |d   j                  di       j                  dg       }|D ]<  }d|v s|d   j                  dd	      }t	        j
                  |d   d
         }||fc S  |D cg c]  }d|v s|j                  dd       }}t        d|d d        c c}w )N
candidateszNo candidates in response: r   r   contentr   
inlineDatamimeTypez
image/jpegdatar	    z"No image in response. Text parts:    )r   getRuntimeErrorstrbase64	b64decode)	responser$   r    r   partmime	img_bytesp
text_partss	            r   extract_image_bytesr2   b   s    ==?D,+J8T4C8IJKKqMi,00"=E #4%))*lCD((l);F)CDId?"	#
 .3Bfk!%%#BJB
;JrN;KL
MM Cs   )	C3Cc                    t         j                  dd       t        d       t        d       t        d       t        d       t        j                         } t        dt        |        d       t        t        fD ]c  }t        d|        t        j                         }t        | |      }t        j                         |z
  }t        d	|j                   d
|dd       |j                  dv rt        d|j                   d       |j                          t        |      \  }}t        dt        |      dd|        d|v rdnd}t        j                  |      }|j                  |       t        d| d
|j!                         j"                  dd       t$        j                  |      }	t'        j(                  ||	       t        d|	        t        d        y  t+        d      )NT)parentsexist_okz<============================================================u0   Concept #44 — Hangul Monument image generationzObtaining auth token...zToken obtained (length: z chars)u   
Calling Gemini API — model: z  HTTP z (z.1fzs))i  i  z  Access denied (u   ) — trying fallback model...z  Image received: ,z bytes, mime=jpegz.jpgz.pngz	  Saved: z bytes)z
  Copied: z
Done.zAll Gemini models failed.)
OUTPUT_DIRmkdirprintgcloud_authget_access_tokenlenMODEL_PRIMARYMODEL_FALLBACKtimer   status_coderaise_for_statusr2   SAMPLE_PATHwith_suffixwrite_bytesstatst_size	COPY_PATHshutilcopy2r(   )
r   r   t0respelapsedr/   r.   extsample	copy_dests
             r   mainrQ   q   s   TD1	(O	
<=	(O 

#$((*E	$SZL
89  0 089YY[5%())+"(()GC=;<z)%d&6&6%77UVW .d3	4"3y>!"4M$HI $fF((-9%	&FKKM$9$9!#<GDE ))#.	VY'
9+&'i;> 2
33r   __main__)r   r)   r   r)   returnrequests.Response)r,   rT   rS   ztuple[bytes, str])rS   None)__doc__
__future__r   r*   rI   sysr@   pathlibr   r   
gen_configr   pathinsertr)   __file__parentr;   r8   rC   rH   r>   r?   r   r   r   r2   rQ   __name__ r   r   <module>ra      s    #   
    % 3tH~,,- . ZZ
<'33	-1D1
hJ N,4^ zF r   