new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

AI Asset Pipeline · all subjects

image-gen/chroma-key

10 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

gen_clean Python API example

Example of gen_clean text-to-image generation: ```python import sys sys.path.insert(0, "/Users/egorfedorov/Downloads/GameDev") from imagegen3 import gen_clean, i2i_clean, NanoBananaClient # Text-to-image → clean RGBA PNG, one call (medium tier @1K): r = gen_clean( "a single shiny gold poker chip, bold outlines, hacksaw style, isolated", output="/abs/path/chip.png", aspect="1:1", quality="medium", # low | medium | high ) # r: { task_id, image_url, model, output_path, chroma_stripped, chroma_rgb } # Premium hero asset: gen_clean(prompt, output=logo_png, quality="high", aspect="16:9") # Cheap bulk symbol: gen_clean(prompt, output=l5_png, quality="low") # Batch — share one client: c = NanoBananaClient() r = gen_clean(prompt, output=out, client=c, quality="medium") ```

Deterministic chroma-key cutout is studio default

The studio default for image generation is gen_clean() or i2i_clean(), which applies deterministic chroma-key cutout to produce clean RGBA PNG files. This uses pure PIL color subtraction (no machine learning, no wasted credits on rembg failures). The cyan clause is automatically injected into prompts and stripped after the API call.

Default chroma color is cyan #00FFFF

The default chroma color for cutout is cyan (#00FFFF). Override the chroma color only if the subject contains cyan; in that case import and use CHROMA_MAGENTA from imagegen3 instead.

No alpha channel generated directly by models

The image generation models do not produce alpha channels natively. Always apply chroma-key stripping (enabled by default with gen_clean) or use rembg as fallback. Prompting for a 'transparent background' without the chroma clause will result in a solid fill, not transparency.

Use magenta #FF00FF chroma for HUDs, not cyan

For HUD generation, use MAGENTA (#FF00FF) as the chroma color instead of the studio default cyan (#00FFFF) because: HUDs frequently contain cyan/teal accent details like jewels and status glows; cyan chroma would erase those interior teal tones (Maya Rush J letter bug, 2026-05-12); magenta never appears in slot/casino palette so it is safe to strip without collateral damage.

chroma_strip.py command and parameters

The chroma_strip.py script is located at ~/.claude/skills/slot-hud-pipeline/scripts/chroma_strip.py. Command: python3 ~/.claude/skills/slot-hud-pipeline/scripts/chroma_strip.py --input /path/frame_raw.png --output /path/frame.png --chroma magenta --tol 30 --spill-tol 70 --alpha-boost. Default parameters (tol=30, spill_tol=70, alpha_boost) are tuned for Pragmatic-style slot art with thick dark outlines.

Anti-pattern: using cyan chroma with teal/blue tones in subject

Do not use cyan chroma when subject has any teal/blue/green tones — cyan chroma will create interior holes in those colors. Use magenta instead for slot/casino themes.

Pillow-based alpha cutout and measurement

Use Pillow to remove the chroma background, despill the edges, validate alpha channel, and export clean transparent PNGs. Measure the transparent cutout regions after chroma-keying to obtain exact pixel boxes for live layers underneath. Example: HP fill starts at x=142, y=38, width=420, height=18. This eliminates guessing and eyeballing CSS.

Chroma-key background for HUD asset generation

Generate HUD element pieces on a flat chroma-key background, typically bright magenta (#FF00FF) or green. Magenta is preferred over cyan because cyan eats teal and blue tones (see Maya Rush J-letter bug).

Default chroma-key tolerance tuning

Empirically tuned default parameters: tolerance=30, spill_tolerance=70, alpha_boost=True.

Give your agent this brain