§
    ÎÐjª  ã                   óÒ   — d dl mZ d dlmZ  ee¦  «                             ¦   «         j        dz  dz  Z ed¬¦  «        dee	e	f         fd„¦   «         Z
 e
¦   «         d	         Zd
ZdS )é    )Ú	lru_cache)ÚPathÚmagic_prompt_system_promptszv1.txtN)ÚmaxsizeÚreturnc                  óh  — i } d }g }t                                d¬¦  «                             ¦   «         D ]¶}|                     ¦   «         }|                     d¦  «        rv|                     d¦  «        rad|vr]|�*d                     |¦  «                             ¦   «         | |<   |dd…                              ¦   «                              ¦   «         }g }Œ¡|                     |¦  «         Œ·|�*d                     |¦  «                             ¦   «         | |<   d	| vrt          t           › d
�¦  «        ‚| S )Nzutf-8)Úencodingú[ú]ú ú
é   éÿÿÿÿÚsystemz has no [SYSTEM] section)
Ú_SYSTEM_PROMPT_FILEÚ	read_textÚ
splitlinesÚstripÚ
startswithÚendswithÚjoinÚlowerÚappendÚ
ValueError)ÚsectionsÚcurrentÚlinesÚlineÚstrippeds        úHC:\Users\johnn\OneDrive\Documents\AI\models\ideogram4\prompt_enhancer.pyÚ_load_sectionsr!      s8  € à€HØ€GØ€EÝ#×-Ò-°wÐ-Ñ?Ô?×JÒJÑLÔLð ð ˆØ—:’:‘<”<ˆØ×Ò˜sÑ#Ô#ð 	¨×(9Ò(9¸#Ñ(>Ô(>ð 	À3ÈhÐCVÐCVØÐ"Ø$(§I¢I¨eÑ$4Ô$4×$:Ò$:Ñ$<Ô$<�˜Ñ!Ø˜q ˜t”n×*Ò*Ñ,Ô,×2Ò2Ñ4Ô4ˆGØˆEˆEà�LŠL˜ÑÔÐÐØÐØ ŸIšI eÑ,Ô,×2Ò2Ñ4Ô4ˆ�ÑØ�xÐÐÝÕ/ÐIÐIÐIÑJÔJÐJØ€Oó    r   az	  
# Ideogram 4 Prompt Notes

Ideogram 4 was trained on structured JSON captions. Supply JSON directly, or optionally use **Magic Prompt** to turn a short idea into JSON. Direct plain text is not the upstream-supported prompting workflow.

## Recommended JSON Shape

Use these top-level keys in this order:

```json
{
  "high_level_description": "One or two sentences describing the whole image.",
  "style_description": {
    "aesthetics": "mood and visual keywords",
    "lighting": "lighting setup",
    "photo": "camera and lens details",
    "medium": "photograph",
    "color_palette": ["#FFFFFF", "#111111"]
  },
  "compositional_deconstruction": {
    "background": "Environment and background description.",
    "elements": [
      {"type": "obj", "bbox": [120, 260, 760, 760], "desc": "A detailed subject description."},
      {"type": "text", "bbox": [80, 100, 180, 900], "text": "EXACT WORDS", "desc": "Typography and placement description."}
    ]
  }
}
```

## Layout And Bboxes

- `compositional_deconstruction` is the most important section for spatial control.
- `bbox` uses normalized coordinates from `0` to `1000`, ordered as `[y_min, x_min, y_max, x_max]`.
- Keep each bbox aligned with its description: if an object is on the left, its `x` values should be low; if it is near the bottom, its `y` values should be high.
- Text elements should use `type: "text"` and include both the exact `text` to render and a `desc` describing font, color, size, and placement.

## Style

- In `style_description`, use either `photo` for photographic prompts or `art_style` for non-photo prompts, not both.
- Include `aesthetics`, `lighting`, and `medium` when you include `style_description`.
- Preserve style key order: `aesthetics`, `lighting`, `photo`, `medium` for photos; `aesthetics`, `lighting`, `medium`, `art_style` otherwise. Optional `color_palette` comes last.
- Use uppercase hex colors like `#1B1B2F`. Up to 16 colors can guide the whole image; up to 5 can guide one element.

## Practical Tips

- `compositional_deconstruction` is required, with `background` before `elements`. `high_level_description` is recommended; `style_description` is optional.
- Keep object descriptions positive and concrete.
- Serialize compactly when possible, with no comments or markdown fences in the prompt itself.
- If writing JSON by hand is tedious, enable **Magic Prompt** and start from a short natural-language idea.
)Ú	functoolsr   Úpathlibr   Ú__file__ÚresolveÚparentr   ÚdictÚstrr!   ÚIDEOGRAM4_PROMPT_ENHANCERÚIDEOGRAM4_PROMPT_INFOS© r"   r    ú<module>r-      s´   ðØ Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð ð �d˜8‘n”n×,Ò,Ñ.Ô.Ô5Ð8UÑUÐX`Ñ`Ð ð €�4ÐÑÔð˜˜S #˜Xœð ð ð ñ Ôðð( +˜NÑ,Ô,¨XÔ6Ð ð1Ð Ð Ð r"   