genimg 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- genimg/__init__.py +4 -0
- genimg/__main__.py +5 -0
- genimg/_skills/genimg/SKILL.md +145 -0
- genimg/_skills/genimg/references/cost-and-provenance.md +15 -0
- genimg/_skills/genimg/references/post-processing.md +6 -0
- genimg/_skills/genimg/references/preferences.md +19 -0
- genimg/_skills/genimg-infographic/LICENSE +21 -0
- genimg/_skills/genimg-infographic/SKILL.md +241 -0
- genimg/_skills/genimg-infographic/agents/openai.yaml +4 -0
- genimg/_skills/genimg-infographic/references/analysis-framework.md +205 -0
- genimg/_skills/genimg-infographic/references/base-prompt.md +43 -0
- genimg/_skills/genimg-infographic/references/config/first-time-setup.md +34 -0
- genimg/_skills/genimg-infographic/references/config/preferences-schema.md +34 -0
- genimg/_skills/genimg-infographic/references/layouts/bento-grid.md +41 -0
- genimg/_skills/genimg-infographic/references/layouts/binary-comparison.md +48 -0
- genimg/_skills/genimg-infographic/references/layouts/bridge.md +41 -0
- genimg/_skills/genimg-infographic/references/layouts/circular-flow.md +41 -0
- genimg/_skills/genimg-infographic/references/layouts/comic-strip.md +41 -0
- genimg/_skills/genimg-infographic/references/layouts/comparison-matrix.md +41 -0
- genimg/_skills/genimg-infographic/references/layouts/dashboard.md +41 -0
- genimg/_skills/genimg-infographic/references/layouts/dense-modules.md +73 -0
- genimg/_skills/genimg-infographic/references/layouts/funnel.md +41 -0
- genimg/_skills/genimg-infographic/references/layouts/hierarchical-layers.md +48 -0
- genimg/_skills/genimg-infographic/references/layouts/hub-spoke.md +41 -0
- genimg/_skills/genimg-infographic/references/layouts/iceberg.md +41 -0
- genimg/_skills/genimg-infographic/references/layouts/isometric-map.md +41 -0
- genimg/_skills/genimg-infographic/references/layouts/jigsaw.md +41 -0
- genimg/_skills/genimg-infographic/references/layouts/linear-progression.md +48 -0
- genimg/_skills/genimg-infographic/references/layouts/periodic-table.md +41 -0
- genimg/_skills/genimg-infographic/references/layouts/story-mountain.md +41 -0
- genimg/_skills/genimg-infographic/references/layouts/structural-breakdown.md +48 -0
- genimg/_skills/genimg-infographic/references/layouts/tree-branching.md +41 -0
- genimg/_skills/genimg-infographic/references/layouts/venn-diagram.md +41 -0
- genimg/_skills/genimg-infographic/references/layouts/winding-roadmap.md +41 -0
- genimg/_skills/genimg-infographic/references/reference-images.md +22 -0
- genimg/_skills/genimg-infographic/references/structured-content-template.md +244 -0
- genimg/_skills/genimg-infographic/references/styles/aged-academia.md +36 -0
- genimg/_skills/genimg-infographic/references/styles/bold-graphic.md +36 -0
- genimg/_skills/genimg-infographic/references/styles/chalkboard.md +61 -0
- genimg/_skills/genimg-infographic/references/styles/claymation.md +29 -0
- genimg/_skills/genimg-infographic/references/styles/corporate-memphis.md +29 -0
- genimg/_skills/genimg-infographic/references/styles/craft-handmade.md +44 -0
- genimg/_skills/genimg-infographic/references/styles/cyberpunk-neon.md +29 -0
- genimg/_skills/genimg-infographic/references/styles/hand-drawn-edu.md +63 -0
- genimg/_skills/genimg-infographic/references/styles/ikea-manual.md +29 -0
- genimg/_skills/genimg-infographic/references/styles/kawaii.md +29 -0
- genimg/_skills/genimg-infographic/references/styles/knolling.md +29 -0
- genimg/_skills/genimg-infographic/references/styles/lego-brick.md +29 -0
- genimg/_skills/genimg-infographic/references/styles/morandi-journal.md +60 -0
- genimg/_skills/genimg-infographic/references/styles/origami.md +29 -0
- genimg/_skills/genimg-infographic/references/styles/pixel-art.md +29 -0
- genimg/_skills/genimg-infographic/references/styles/pop-laboratory.md +48 -0
- genimg/_skills/genimg-infographic/references/styles/retro-pop-grid.md +47 -0
- genimg/_skills/genimg-infographic/references/styles/retro-popup-pop.md +50 -0
- genimg/_skills/genimg-infographic/references/styles/storybook-watercolor.md +29 -0
- genimg/_skills/genimg-infographic/references/styles/subway-map.md +29 -0
- genimg/_skills/genimg-infographic/references/styles/technical-schematic.md +36 -0
- genimg/_skills/genimg-infographic/references/styles/ui-wireframe.md +29 -0
- genimg/_skills/genimg-visual-exploration/SKILL.md +112 -0
- genimg/_skills/genimg-visual-exploration/agents/openai.yaml +4 -0
- genimg/_skills/genimg-visual-review/SKILL.md +86 -0
- genimg/_skills/genimg-visual-review/agents/openai.yaml +4 -0
- genimg/_skills/image-to-app/SKILL.md +74 -0
- genimg/_skills/image-to-app/agents/openai.yaml +4 -0
- genimg/_skills/image-to-app/references/implementation-handoff.md +19 -0
- genimg/_skills/image-to-app/references/visual-qa.md +42 -0
- genimg/auth/__init__.py +8 -0
- genimg/auth/base.py +124 -0
- genimg/auth/codex.py +76 -0
- genimg/auth/google.py +243 -0
- genimg/auth/openai.py +160 -0
- genimg/auth/resolve.py +93 -0
- genimg/cli.py +1184 -0
- genimg/config.py +120 -0
- genimg/cost.py +87 -0
- genimg/discovery.py +100 -0
- genimg/diversify.py +73 -0
- genimg/draw.py +1244 -0
- genimg/generate.py +29 -0
- genimg/grid.py +610 -0
- genimg/history.py +51 -0
- genimg/history_view.py +508 -0
- genimg/interfaces.py +121 -0
- genimg/metadata.py +243 -0
- genimg/provenance.py +88 -0
- genimg/providers/__init__.py +15 -0
- genimg/providers/base.py +178 -0
- genimg/providers/codex.py +213 -0
- genimg/providers/google.py +233 -0
- genimg/providers/listing.py +33 -0
- genimg/providers/openai.py +310 -0
- genimg/registry.py +119 -0
- genimg/setup.py +410 -0
- genimg-0.1.0.dist-info/METADATA +74 -0
- genimg-0.1.0.dist-info/RECORD +99 -0
- genimg-0.1.0.dist-info/WHEEL +4 -0
- genimg-0.1.0.dist-info/entry_points.txt +2 -0
- genimg-0.1.0.dist-info/licenses/LICENSE +21 -0
- genimg-0.1.0.dist-info/licenses/skills/genimg-infographic/LICENSE +21 -0
genimg/__init__.py
ADDED
genimg/__main__.py
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: genimg
|
|
3
|
+
description: Generate and edit raster images with the genimg CLI (OpenAI GPT Image, Google Gemini Image, Codex subscription). Use before running any genimg command, and whenever the user wants an image made, edited or varied, such as a logo, icon, favicon, illustration, poster, photo, mockup, raster diagram, or a set of options to pick from. Skip it for charts and diagrams drawn as code (SVG, HTML, plotting libraries).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# genimg
|
|
7
|
+
|
|
8
|
+
`genimg "PROMPT" [REF_PATHS...] [OPTIONS]` writes one PNG per image (`-o path`, else under `~/.genimg/generations/`). Read generation flags from the table below rather than `--help`. The subcommands (`auth`, `setup`, `models`, `grid`, `history`, `cost`, `config`) document themselves with `--help`, and most take `--json`.
|
|
9
|
+
|
|
10
|
+
## Before the first call
|
|
11
|
+
|
|
12
|
+
1. Load the `genimg-preferences` skill if it exists. Its taste overrides this skill's defaults; the current request overrides both. When the user states a lasting preference for all their images, record it as [references/preferences.md](references/preferences.md) describes.
|
|
13
|
+
2. Pass `-m` on every call. genimg has no built-in model; `genimg models get-default` shows one the user saved.
|
|
14
|
+
3. If a provider is not authenticated, `genimg auth --modes` names the env vars each auth mode reads. The user puts the key in the environment; never take it in chat or pass it as an argument. Then run `genimg setup` yourself: without a terminal it never prompts, saves each provider whose key validates, and exits 1 if none does. `genimg auth --check` runs a tiny live generation on the Google and OpenAI providers' fixed canary models (Codex: login only), which proves the provider, not the model you pick; adding `--json` skips that probe.
|
|
15
|
+
4. Preflight any call with `-n > 1`, `-q high` or `-r 4K` with `--dry-run`: it prints model, resolved size, cost and planned paths without calling the API, and exits 1 with an `auth ✗` line when the run would fail on auth.
|
|
16
|
+
|
|
17
|
+
## Choosing a model
|
|
18
|
+
|
|
19
|
+
| Need | Model |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| Legible in-image text, glyphs, logos, UI | `oai:gi2` (gpt-image-2) |
|
|
22
|
+
| Photographic or painterly quality | `gdm:nbp` (Gemini 3 Pro Image) |
|
|
23
|
+
| Structured diagrams: arrows, labelled cells, fixed layout | `gdm:nb2` to explore, `gdm:nbp` for finals (see *Diagrams*) |
|
|
24
|
+
| No API key, the user's ChatGPT subscription | `codex:image` |
|
|
25
|
+
|
|
26
|
+
`genimg models` lists every model; `--aliases` adds the alias mappings.
|
|
27
|
+
|
|
28
|
+
- **GPT Image 2.5:** `oai:gi2.5` (`gpt-image-2.5-sunburst`) and `oai:gi2.5-flare` generate and edit, and add `-q xhigh` and `-q max`. Availability depends on the endpoint, so the first real generation is what proves the model serves. On 2.5's cheaper price grid, `high` costs what gi2 `medium` does. The model comparisons in this skill were measured on gpt-image-2, not 2.5.
|
|
29
|
+
- **Codex:** `codex:image` starts an ephemeral Codex agent on the user's ChatGPT login (`codex login`) and records the result in history. Generation, `-i`, references, `-n` and `-d` work. Codex picks the image model and size, so `-a` is a request and no flag selects a version: never promise GPT Image 2.5 or infer a version from a filename. A host `image_gen` tool call bypasses genimg and its history.
|
|
30
|
+
|
|
31
|
+
## Flags (generation)
|
|
32
|
+
|
|
33
|
+
| Flag | Short | Values | Constraints |
|
|
34
|
+
| --- | --- | --- | --- |
|
|
35
|
+
| `--model` | `-m` | alias or canonical id (`gdm:nb2`, `oai:gi2`, `codex:image`, `gpt-image-2`) | required unless a default is saved |
|
|
36
|
+
| `--output` | `-o` | PNG path | `n>1` writes `stem_1.png … stem_n.png`; default `~/.genimg/generations/<id>.png` |
|
|
37
|
+
| `--num` | `-n` | 1–10 | runs in parallel; pair with `-d`/`--deltas` for real variety |
|
|
38
|
+
| `--diverse` | `-d` | flag | needs `-n >= 2`; curated deltas for #2..#n (#1 = base prompt) |
|
|
39
|
+
| `--deltas` | | `"a, b, c"` or `@file` | your own deltas for #2..#n, implies `-d`; parallel mode only |
|
|
40
|
+
| `--mode` | | `parallel` (default) \| `batch` | `batch` = ONE n-image request, Gemini only; rejected on OpenAI |
|
|
41
|
+
| `--input` | `-i` | image path | image-to-image edit; stays close to the input |
|
|
42
|
+
| `REF_PATHS` | | paths after the prompt | references for style/layout, order preserved, never edited |
|
|
43
|
+
| `--aspect-ratio` | `-a` | `1:1 4:3 3:4 16:9 9:16 3:2 2:3 4:5 5:4 21:9`; `gdm:nb2`/`nb2-lite` add `1:4 1:8 4:1 8:1` | OpenAI: `16:9`/`9:16` need `-r 2K` or `4K`; `4:3`/`3:4` need `1K` or `2K`; `gi1`/`gi1-mini`/`gi1.5`: `1:1` only |
|
|
44
|
+
| `--resolution` | `-r` | `512 1K 2K 4K` | `gdm:nb2`: all four; `gdm:nbp`: `1K 2K 4K`; `gdm:nb2-lite`: `1K`; OpenAI: `1K 2K 4K` per the aspect rule (`gi1`/`gi1-mini`/`gi1.5`: `1K` only); `codex:image`: none |
|
|
45
|
+
| `--quality` | `-q` | `low medium high auto`; `oai:gi2.5`/`gi2.5-flare` add `xhigh max` | OpenAI only; default `medium`; `high` is 30–90 s/image |
|
|
46
|
+
| `--thinking` | | `minimal` \| `high` | `gdm:nb2` and `gdm:nb2-lite` only |
|
|
47
|
+
| `--profile` | | `[profiles.NAME]` from `~/.config/genimg/config.toml` | must match the model's provider; default = provider's first profile, else env detection |
|
|
48
|
+
| `--auth` | | `azure` \| `direct` | OpenAI only; forces a mode for one run |
|
|
49
|
+
| `--region` | | e.g. `global`, `us-central1` | Google only |
|
|
50
|
+
| `--project` | | GCP project id | Google Vertex only |
|
|
51
|
+
| `--name` | | one-line label | recorded in history; name any generation you may revisit |
|
|
52
|
+
| `--grid` | `-g` | flag | with `-n >= 2`, also writes an HTML grid under `~/.genimg/grids/` |
|
|
53
|
+
| `--open` | | flag | opens the grid (or the single image) in the browser; steals focus on macOS |
|
|
54
|
+
| `--dry-run` | | flag | prints model, resolved size, cost and planned paths; no API call |
|
|
55
|
+
|
|
56
|
+
`codex:image` accepts none of `-q -r --thinking --auth --region --project --mode batch`; `-a` becomes a prompt request.
|
|
57
|
+
|
|
58
|
+
## Getting real variations
|
|
59
|
+
|
|
60
|
+
- **Prompt for a SINGLE subject and let `-n N` make the variety.** A prompt asking to "explore variations" or "show options" packs a contact sheet into one image. Write "a SINGLE centered X, NOT a grid, not a montage". Make every set with one `-n` call, so the images share numbered outputs and one grid.
|
|
61
|
+
- **Add `-d` for simple subjects** (logo, icon, single object). Plain `-n` converges on near-duplicates there. `-d` appends a curated style or composition delta to #2..#n (#1 keeps the base prompt), and the grid and metadata record each delta, so a pick is reproducible. Long, complex prompts often diversify without it.
|
|
62
|
+
- **You are the tailored-diversity engine: write subject-specific `--deltas`.** genimg calls no text LLM, and the built-in `-d` pool is generic style, lighting and framing hints tuned for illustrations and logos; it transfers poorly to diagrams, photos and technical subjects. Pass `--deltas "blueprint schematic, hand-drawn whiteboard, isometric cutaway"` (inline splits on commas) or `--deltas @styles.txt` (one per line, commas allowed, `#` comments). Set `-n` to the delta count plus one: fewer deltas is an error, and extras are silently dropped.
|
|
63
|
+
- **Pick the spread by intent.** `--deltas` or bare `-d` in parallel mode works on every provider and gives the most *controlled* spread: you name the axes. `-d --mode batch` on Gemini sends ONE request in which the model curates a deliberately different *set*; it may return fewer than n and takes about 30 s against 8 s. OpenAI rejects `--mode batch`: GPT Image n>1 returns near-duplicates of one prompt.
|
|
64
|
+
|
|
65
|
+
## Editing versus referencing
|
|
66
|
+
|
|
67
|
+
- **`-i FILE` edits that image and stays close to it.** Once a candidate is close, iterate with `-i` and a small instruction ("same icon, thicker strokes") rather than regenerating.
|
|
68
|
+
- **A reference after the prompt guides style, not composition.** Use it for related but freely varied results: `genimg "new layout, same palette" ref.png -m gdm:nbp`.
|
|
69
|
+
- **Style-lock a family of assets:** generate one hero asset, then pass it as a reference to every sibling. Check each reference path exists first; a missing reference fails the generation, and in a background job the error scrolls away.
|
|
70
|
+
|
|
71
|
+
## Showing candidates to a human
|
|
72
|
+
|
|
73
|
+
1. Generate to real `-o` paths. The output stem plus index (`gemini_3`, `gpt_1`) is each candidate's stable ID; never rename or renumber one someone has seen, and give a later round a new stem. Keep `selection-manifest.md` with run, model, delta, original index, filename and status (liked, rejected).
|
|
74
|
+
2. Put every candidate in one grid and open it before asking anything: `-g --open` for one run, `genimg grid a.png b.png … -o cmp.html --open` across runs or providers. A generation grid lands under `~/.genimg/grids/`; use the path the CLI prints. To open without stealing focus on macOS, drop `--open` and run `open -g <grid.html>`. An arbitrary-file grid shows filenames rather than per-run metadata, so the manifest stays the source of truth.
|
|
75
|
+
3. Hand the grid back as a `file://` link: `[grid.html](file:///abs/path/grid.html)`.
|
|
76
|
+
4. For 3 to 20 strong candidates, point the user at the grid's **Tournament** button (pairwise picks, n−1 for a winner, one more for a top 3 unless there are exactly three) and ask them to paste back **Copy result (JSON)**: winner, ranking and every pick, by grid number, filename, and model when a sidecar knows it.
|
|
77
|
+
|
|
78
|
+
The step is done when the user has chosen from images on screen. For a broad spread of serious options (a brief, three to six directions, several providers, recombining the winners), load `genimg-visual-exploration` if it is installed. Without it, run a Gemini spread of four to six (`-n 5 -d` or tailored `--deltas`), add one to three `oai:gi2` variants with explicit deltas when typography or UI matters, and compare all of them in one grid. If a provider or model changes after a failure, say so before presenting results.
|
|
79
|
+
|
|
80
|
+
Make assets light unless the user asks for dark mode or paired themes; derive a requested dark variant from the chosen finalist.
|
|
81
|
+
|
|
82
|
+
## Product screenshots and publication copy
|
|
83
|
+
|
|
84
|
+
- For product updates, use an authentic screenshot or logo as the evidence layer and let generation add diagrams, illustration or framing around it. Pass screenshots as references for loose integration; composite deterministically when pixels must stay exact.
|
|
85
|
+
- User-supplied copy is authoritative. Do a full-resolution defect pass for invented dates, misspellings, leaked instructions, wrong commands and garbled labels. If publication-critical text is unreliable in the raster, add it after generation.
|
|
86
|
+
- Verify commands and factual labels against current project or package metadata before delivery.
|
|
87
|
+
|
|
88
|
+
## Multi-view edits without drift
|
|
89
|
+
|
|
90
|
+
- Start every view from source: use each original camera angle as `-i` and pass the same approved image as the locked appearance reference after the prompt.
|
|
91
|
+
- Change one decision per call so any drift has one attributable cause.
|
|
92
|
+
- Never feed a generated angle into the next angle. If a view visibly drifts, reset to the originals and the approved reference rather than editing the drifted result again.
|
|
93
|
+
- Keep failed variants as human reject examples, not model inputs.
|
|
94
|
+
|
|
95
|
+
genimg is the controlled front end for this workflow; it is not a separate image model. Record the provider and model actually used, such as GPT Image 2, with every result.
|
|
96
|
+
|
|
97
|
+
## Diagrams
|
|
98
|
+
|
|
99
|
+
Flowcharts, layered diagrams and anything with **arrows, a fixed grid of labelled cells, or a required spatial layout** behave differently from illustrations:
|
|
100
|
+
|
|
101
|
+
- **Model choice flips to Gemini.** `gdm:nbp` and `gdm:nb2` follow spatial instructions (trajectories, start markers, adjacency, "don't skip a layer") far better; gpt-image-2 renders crisper text but reverts to generic per-cell arrows. At 1K `gdm:nb2` costs half of `gdm:nbp` (less of a saving at 2K and 4K; `--dry-run` prices each) and often matches it on layout, so explore with it. Use `oai:gi2` only when text crispness dominates and the layout is simple.
|
|
102
|
+
- **Fix structure with a fresh prompt, cosmetics with `-i`.** `-i` handles small text and colour tweaks but ignores or mangles structural edits (reroute an arrow, move a cell) and piles up mess over rounds. When the structure is wrong, regenerate from a fully specified prompt. Keep `-i` for the last one or two cosmetic fixes and pass `-a` on them: an unflagged gpt-image-2 `-i` can default to 1024×1024 and squash the source.
|
|
103
|
+
- **Pin every element.** Give an exact row-to-cell mapping ("Environment row: 'morning cue'; Behaviour row: 'brew' …") and state spatial rules as absolutes: "the path steps between ADJACENT rows only"; "one START dot per column"; "solid line = bottom-up, dotted = top-down".
|
|
104
|
+
- **Phrase constraints so they cannot read as content.** Instructions leak into renders as labels (a "No empty boxes." instruction once printed in the legend), so scan every label for leaked phrases.
|
|
105
|
+
- **Zoom for the defect pass.** Thumbnails hide skipped cells, duplicate icons and garbled labels. Crop each region and read it: `magick in.png -crop WxH+X+Y +repage region.png`.
|
|
106
|
+
- **Quality sharpens rendering, not structure.** `-q high` leaves a wrong arrow layout wrong; `-q medium` is usually enough for `-i` edits.
|
|
107
|
+
|
|
108
|
+
## Recipes
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Explore options for a human to pick (4 takes + grid + open).
|
|
112
|
+
genimg "a SINGLE centered editorial illustration of a sprint board, flat vector, off-white bg, NOT a grid" -m gdm:nb2 -n 4 -g --open -a 16:9
|
|
113
|
+
|
|
114
|
+
# Cross-provider portfolio, then one native comparison grid.
|
|
115
|
+
genimg "a SINGLE light-mode editorial product-update poster, NOT a grid" app-light.png -m gdm:nb2 -n 5 -d -a 16:9 -o gemini.png
|
|
116
|
+
genimg "a SINGLE crisp light-mode editorial product-update poster, NOT a grid" app-light.png -m oai:gi2 -n 2 --deltas "screen-led split layout" -a 16:9 -r 2K -q high -o gpt.png
|
|
117
|
+
genimg grid gemini_*.png gpt_*.png -o finalists.html --open
|
|
118
|
+
|
|
119
|
+
# Simple subject → engineer the spread with -d (per-generation prompt deltas, shown in the grid).
|
|
120
|
+
genimg "a SINGLE minimal fox logo, NOT a grid" -m oai:gi2 -n 4 -d -g --open
|
|
121
|
+
|
|
122
|
+
# Let the MODEL diversify instead: one Gemini request, model differentiates its own 4 takes.
|
|
123
|
+
genimg "a SINGLE minimal fox logo, NOT a grid" -n 4 -d --mode batch -m gdm:nb2 -g --open
|
|
124
|
+
|
|
125
|
+
# A logo or app icon: one mark, flat, exact colours, square.
|
|
126
|
+
genimg "A SINGLE minimal flat-vector app icon, one mark centered, NOT a grid/montage: <subject>. Black line-art + one emerald-green accent on warm off-white. NO gradient, NO 3D, NO text." -m oai:gi2 -n 4 -g --open -a 1:1 -q high -o logo.png
|
|
127
|
+
|
|
128
|
+
# Favicon from a chosen logo (downscale; browsers render one PNG fine).
|
|
129
|
+
sips -z 128 128 logo_2.png --out public/favicon.png # then <link rel="icon" href="/favicon.png">
|
|
130
|
+
|
|
131
|
+
# Edit/iterate on a chosen result (stays close to it).
|
|
132
|
+
genimg "same icon, slightly thicker strokes, larger marks" -m oai:gi2 -i logo_2.png -o logo-v2.png
|
|
133
|
+
|
|
134
|
+
# Match an existing style with a new layout (reference, not edit).
|
|
135
|
+
genimg "same palette and line weight, new composition" ref1.png ref2.png -m gdm:nbp -o styled.png
|
|
136
|
+
|
|
137
|
+
# Pick a model explicitly.
|
|
138
|
+
genimg "warm cinematic photo of a mountain cabin at night" -m gdm:nbp -o cabin.png
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Further reference
|
|
142
|
+
|
|
143
|
+
- Before reporting spend, billing, provenance or speed, read [references/cost-and-provenance.md](references/cost-and-provenance.md).
|
|
144
|
+
- Before cropping, matting out a background, slicing a sprite sheet, or embedding images in an HTML page of your own, read [references/post-processing.md](references/post-processing.md).
|
|
145
|
+
- `genimg history` lists recent generations (`--json` gives absolute paths); `genimg history view` is a TUI for the user to browse every image.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Cost, provenance and timing
|
|
2
|
+
|
|
3
|
+
## Cost
|
|
4
|
+
|
|
5
|
+
- `--dry-run` prints the estimate for a planned call; `genimg cost` totals estimated spend, and `genimg history` shows it per generation.
|
|
6
|
+
- Estimates count output tokens only. At 1024×1024: `oai:gi2` medium $0.053, high $0.211; `oai:gi2.5` medium $0.013, high $0.053, max $0.211. A wide 2K render can cost less than a 1K square: `oai:gi2` medium at 2048×1152 is $0.042.
|
|
7
|
+
|
|
8
|
+
## Billing and provenance
|
|
9
|
+
|
|
10
|
+
- Each generation records `billing` (`subscription` or `api`) from its route. `api_equivalent_cost` is a separate, theoretical comparison, and a rough range when the native quality is unknown: report it as a comparison, never as a charge, and keep it out of subscription spend. Unknown models and prices stay unknown.
|
|
11
|
+
- genimg captures each image's C2PA claim (extracted offline, not signature-verified), generator, dimensions and hash. PNGs that carry credentials keep their bytes unchanged; genimg's own fields go in sidecar files.
|
|
12
|
+
|
|
13
|
+
## Timing
|
|
14
|
+
|
|
15
|
+
One-shot CLI wall time includes local setup and cold start, so it is not provider latency. Record setup time and provider-call time separately, and state which clock each comparison uses.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Post-processing generated images
|
|
2
|
+
|
|
3
|
+
- **Crop with Pillow by scanning rows** for the first and last dark pixels (`r/g/b < ~210`), plus a margin. `getbbox()` fails on anti-aliased near-white edges.
|
|
4
|
+
- **Solidify after background-key matting.** Keying out a background by colour distance turns pale subject pixels semi-transparent and leaves interior holes that hide at thumbnail size. Flood-fill transparency from the border to find the truly external pixels, fill interior holes with the nearest opaque colour, and snap body alpha ≥ ~90 to 255. Verify at 2× zoom on the flagged region and by counting alpha pixels before and after.
|
|
5
|
+
- **Slice a sprite sheet by alpha column runs, not a fixed grid.** Columns whose alpha never passes the threshold separate irregular sprites (ignore runs under ~30 px). The same per-column coverage profile measures composition flaws before you crop.
|
|
6
|
+
- **Embed images as base64 in HTML for the Claude Code preview panel.** The panel sandboxes the page, so a relative `<img src="sibling.png">` renders blank there; inline `data:image/png;base64,…` instead. A normal browser tab loads relative paths fine. For comparing candidates, `genimg grid` already builds the page.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Recording the user's image preferences
|
|
2
|
+
|
|
3
|
+
The first time the user states a lasting preference for all their images (a style, a palette, "always sober"), create a `genimg-preferences` skill and record the preference in the user's words. Add later preferences to the same file; when one replaces or retracts an entry, edit or delete that entry so the file never contradicts itself. Create it only once the user has stated a preference; a guess about their taste stays out of it. A preference for one project or brand belongs in that project's own agent instructions.
|
|
4
|
+
|
|
5
|
+
Put it where the agent loads user-level skills, next to the installed `genimg` skill, even when genimg is installed in a project, so the preferences follow the user:
|
|
6
|
+
|
|
7
|
+
- Claude Code: `~/.claude/skills/genimg-preferences/SKILL.md`
|
|
8
|
+
- Agents that read `~/.agents/skills/`: `~/.agents/skills/genimg-preferences/SKILL.md`
|
|
9
|
+
|
|
10
|
+
Start the file with:
|
|
11
|
+
|
|
12
|
+
```markdown
|
|
13
|
+
---
|
|
14
|
+
name: genimg-preferences
|
|
15
|
+
description: "The user's lasting preferences for generated images. Load with genimg before every generation or edit."
|
|
16
|
+
---
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The skill belongs to the user. genimg never ships it, so updating genimg never overwrites it.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jim Liu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: genimg-infographic
|
|
3
|
+
description: "Turn a text, file, URL or topic into one publication-ready raster infographic with GenIMG. Use when the user asks for an infographic, visual summary, high-density visual guide, 信息图 or 可视化. Skip it for charts whose numbers must plot exactly (draw those in code)."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# GenIMG Infographic
|
|
7
|
+
|
|
8
|
+
Adapted from Jim Liu's `baoyu-infographic` v1.117.4 under the MIT licence. Preserve its layout/style methodology and attribution; use `genimg` for every render.
|
|
9
|
+
|
|
10
|
+
Load the `genimg` skill before invoking the CLI.
|
|
11
|
+
|
|
12
|
+
## Rules
|
|
13
|
+
|
|
14
|
+
- Preserve source statistics, quotes, names, dates and technical terms exactly, and add no new facts.
|
|
15
|
+
- Strip credentials, tokens and secrets from source material before writing output files.
|
|
16
|
+
- Render with GenIMG. The deliverable is a raster image; SVG, HTML, canvas or CSS art is a different deliverable that needs the user's say-so.
|
|
17
|
+
- Correct wrong rendered text by fixing the prompt and regenerating; never paint over the bitmap.
|
|
18
|
+
- Save the full final prompt under `prompts/` before generating.
|
|
19
|
+
|
|
20
|
+
## Output structure
|
|
21
|
+
|
|
22
|
+
```text
|
|
23
|
+
infographic/<topic-slug>/
|
|
24
|
+
├── source.<ext>
|
|
25
|
+
├── analysis.md
|
|
26
|
+
├── structured-content.md
|
|
27
|
+
├── refs/ # only when references were supplied
|
|
28
|
+
│ └── 01-ref-<slug>.<ext>
|
|
29
|
+
├── prompts/
|
|
30
|
+
│ └── infographic.md
|
|
31
|
+
├── candidates/ # only for multi-candidate work
|
|
32
|
+
├── iterations/ # only when regenerating a single candidate
|
|
33
|
+
├── infographic.png
|
|
34
|
+
├── selection-manifest.md # whenever more than one render or iteration exists
|
|
35
|
+
└── comparison.html # only for multi-candidate work
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Use a 2-4 word kebab-case slug. If the directory exists, append `-YYYYMMDD-HHMMSS` rather than overwrite prior work.
|
|
39
|
+
|
|
40
|
+
## Workflow
|
|
41
|
+
|
|
42
|
+
### 1. Load preferences
|
|
43
|
+
|
|
44
|
+
Read the first `EXTEND.md` found:
|
|
45
|
+
|
|
46
|
+
1. `.genimg/infographic/EXTEND.md`
|
|
47
|
+
2. `${XDG_CONFIG_HOME:-$HOME/.config}/genimg/infographic/EXTEND.md`
|
|
48
|
+
3. `$HOME/.genimg/infographic/EXTEND.md`
|
|
49
|
+
|
|
50
|
+
If none exists, use the automatic defaults in `references/config/first-time-setup.md` and continue without creating a file or asking setup questions. When the user asks to change preferences, edit or remove the first matching file; the fields are in `references/config/preferences-schema.md`.
|
|
51
|
+
|
|
52
|
+
### 2. Analyse the source
|
|
53
|
+
|
|
54
|
+
Load `references/analysis-framework.md`.
|
|
55
|
+
|
|
56
|
+
1. Save the supplied text, file, URL content or topic material as `source.<ext>`.
|
|
57
|
+
2. If the user supplied reference images, preserve and classify them as `references/reference-images.md` describes.
|
|
58
|
+
3. Identify the topic, data type, complexity, tone, audience, language, learning objectives and visual opportunities.
|
|
59
|
+
4. Extract critical facts verbatim.
|
|
60
|
+
5. Save `analysis.md`.
|
|
61
|
+
|
|
62
|
+
### 3. Structure the content
|
|
63
|
+
|
|
64
|
+
Load `references/structured-content-template.md` and write `structured-content.md` containing:
|
|
65
|
+
|
|
66
|
+
- Title and 1-3 learning objectives.
|
|
67
|
+
- Sections with a key concept, verbatim content, visual element and exact labels.
|
|
68
|
+
- A consolidated list of statistics, quotes and key terms.
|
|
69
|
+
- User-provided design instructions.
|
|
70
|
+
|
|
71
|
+
### 4. Select automatically
|
|
72
|
+
|
|
73
|
+
Select one coherent configuration without a question panel, in this priority order:
|
|
74
|
+
|
|
75
|
+
1. Explicit constraints in the current request.
|
|
76
|
+
2. A compatible saved preference.
|
|
77
|
+
3. A matching keyword shortcut (table below).
|
|
78
|
+
4. Source structure, tone, audience, language and visual density, using the content-type pairings in `references/analysis-framework.md`.
|
|
79
|
+
|
|
80
|
+
Choose:
|
|
81
|
+
|
|
82
|
+
- the layout and style from the galleries below (without other signals, `bento-grid` + `craft-handmade`);
|
|
83
|
+
- the aspect: `landscape` (`16:9`), `portrait` (`9:16`), `square` (`1:1`) or another ratio the model supports;
|
|
84
|
+
- the output language;
|
|
85
|
+
- the resolution (`2K` unless the model or output needs another);
|
|
86
|
+
- the model, through *Model selection* below;
|
|
87
|
+
- one final image, unless the user asked for alternatives.
|
|
88
|
+
|
|
89
|
+
State the selected configuration in a concise progress update, then continue immediately. Do not present a menu or ask for confirmation unless the user explicitly asks to compare or choose among alternatives. If constraints conflict, preserve source fidelity and legibility, record the trade-off, and proceed with the strongest fit.
|
|
90
|
+
|
|
91
|
+
### 5. Build the prompt
|
|
92
|
+
|
|
93
|
+
Load:
|
|
94
|
+
|
|
95
|
+
- `references/base-prompt.md`
|
|
96
|
+
- `references/layouts/<layout>.md`
|
|
97
|
+
- `references/styles/<style>.md` for a built-in style, or the configured `prompt_fragment` for a custom style
|
|
98
|
+
- `structured-content.md`
|
|
99
|
+
|
|
100
|
+
Assemble one complete prompt at `prompts/infographic.md`, with reference provenance in its frontmatter and any extracted style or palette traits appended. Pin every required cell, row, arrow, label and metric explicitly. Phrase constraints so they cannot be mistaken for visible labels.
|
|
101
|
+
|
|
102
|
+
`genimg` treats its whole first argument as prompt text, so the frontmatter would leak into the render as pseudo-labels, and a leading `---` can parse as a flag. Strip it into a variable and pass that to the preflight and every generate call:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
PROMPT=$(awk 'NR==1 && /^---$/{skip=1; next} skip && /^---$/{skip=0; next} !skip' prompts/infographic.md)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 6. Preflight
|
|
109
|
+
|
|
110
|
+
Run the exact planned command with `--dry-run`, passing only `direct` reference images positionally after the prompt:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
genimg "$PROMPT" [refs...] \
|
|
114
|
+
-m <model> -a <ratio> -r <resolution> \
|
|
115
|
+
-o infographic.png --dry-run
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Check the model, parameters, output path and estimated cost, and resolve any mismatch. Before a material batch, report the estimated cost (as information, not a request for permission), then render and inspect one candidate at the lowest resolution the exact model and aspect support (OpenAI `16:9` and `9:16` need at least `2K`). A dry-run checks only the local plan and calls no API; `genimg auth --check` proves each Google and OpenAI provider on its fixed canary model and checks only the login for Codex. That first real render is what proves the selected model serves.
|
|
119
|
+
|
|
120
|
+
### 7. Generate
|
|
121
|
+
|
|
122
|
+
For one image:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
mkdir -p iterations
|
|
126
|
+
genimg "$PROMPT" [refs...] \
|
|
127
|
+
-m <model> -a <ratio> -r <resolution> \
|
|
128
|
+
-o iterations/01-initial.png
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
For alternatives, keep one subject and one information architecture. Write `prompts/style-deltas.txt` with exactly `<count> - 1` subject-specific lines (candidate 1 keeps the base prompt; candidates 2 to `<count>` get the deltas in order), then make one `-n` call:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
mkdir -p candidates
|
|
135
|
+
genimg "$PROMPT" [refs...] \
|
|
136
|
+
-m <model> -a <ratio> -r <resolution> \
|
|
137
|
+
-n <count> --deltas @prompts/style-deltas.txt \
|
|
138
|
+
-o candidates/infographic.png
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Record each candidate's stable ID (`infographic_2`), model, original index, filename and review state in `selection-manifest.md`.
|
|
142
|
+
|
|
143
|
+
### 8. Inspect and iterate
|
|
144
|
+
|
|
145
|
+
Open every candidate at full resolution. For dense diagrams, crop and inspect each title, panel, legend, footer and connection path. Check:
|
|
146
|
+
|
|
147
|
+
- Exact text and numbers.
|
|
148
|
+
- Required cells and labels are present once.
|
|
149
|
+
- Arrows and spatial relationships follow the prompt.
|
|
150
|
+
- No instruction text leaked into the artwork.
|
|
151
|
+
- Nothing important is cropped or illegible.
|
|
152
|
+
|
|
153
|
+
If the structure is wrong, regenerate from a corrected full prompt to a new versioned path such as `iterations/02-corrected-arrows.png`. Use `-i` only for a small cosmetic edit to a selected image, passing the aspect again and writing a new versioned file. Every attempt gets a fresh path and a row in `selection-manifest.md`; flawed candidates stay for comparison. After acceptance, copy the selected file unchanged to `infographic.png`.
|
|
154
|
+
|
|
155
|
+
For multiple candidates, build the grid and open it for the user before asking them to choose:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
genimg grid <candidate-files...> -o comparison.html --open
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Done when `infographic.png` passes every check above, or the user has picked it from the grid.
|
|
162
|
+
|
|
163
|
+
### 9. Report
|
|
164
|
+
|
|
165
|
+
Report the topic, layout, style, aspect, language, model, resolution, estimated or recorded cost, output paths and any remaining defects. Name the recommended candidate when there is one.
|
|
166
|
+
|
|
167
|
+
## Model selection
|
|
168
|
+
|
|
169
|
+
1. Honour a model explicitly named in the current request.
|
|
170
|
+
2. Use `preferred_model` from `EXTEND.md` when it currently works; otherwise fall through, and state the substitution.
|
|
171
|
+
3. Otherwise run `genimg auth --check` (without `--json`, which skips the live probe) and read `genimg models --json`, then choose:
|
|
172
|
+
- `gdm:nb2` for multi-cell diagrams, arrows, fixed spatial layouts and broad exploration.
|
|
173
|
+
- `gdm:nbp` for painterly or highly illustrative infographics where structure still matters.
|
|
174
|
+
- `oai:gi2` for simple layouts where exact typography and crisp UI treatment dominate.
|
|
175
|
+
4. If no suitable configured model serves, stop and explain the available setup path.
|
|
176
|
+
|
|
177
|
+
Always pass `-m`.
|
|
178
|
+
|
|
179
|
+
## Keyword shortcuts
|
|
180
|
+
|
|
181
|
+
A match makes the mapped layout the leading selection, promotes its listed styles, and supplies the default aspect, unless explicit constraints, a compatible saved preference or the source structure require another choice.
|
|
182
|
+
|
|
183
|
+
| User keyword | Layout | Recommended styles | Default aspect | Prompt notes |
|
|
184
|
+
| --- | --- | --- | --- | --- |
|
|
185
|
+
| `高密度信息大图` / `high-density-info` | `dense-modules` | `morandi-journal`, `pop-laboratory`, `retro-pop-grid`, `retro-popup-pop` | portrait | — |
|
|
186
|
+
| `信息图` / `infographic` | `bento-grid` | `craft-handmade` | landscape | Clean canvas, ample whitespace, no complex background textures; simple cartoon elements and icons only. |
|
|
187
|
+
|
|
188
|
+
## Layout gallery
|
|
189
|
+
|
|
190
|
+
| Layout | Best for |
|
|
191
|
+
| --- | --- |
|
|
192
|
+
| `linear-progression` | Timelines, processes, tutorials |
|
|
193
|
+
| `binary-comparison` | A vs B, before/after, pros/cons |
|
|
194
|
+
| `comparison-matrix` | Multi-factor comparisons |
|
|
195
|
+
| `hierarchical-layers` | Pyramids, priority levels |
|
|
196
|
+
| `tree-branching` | Categories, taxonomies |
|
|
197
|
+
| `hub-spoke` | Central concept with related items |
|
|
198
|
+
| `structural-breakdown` | Exploded views, cross-sections |
|
|
199
|
+
| `bento-grid` | Multiple topics and overviews |
|
|
200
|
+
| `iceberg` | Surface vs hidden aspects |
|
|
201
|
+
| `bridge` | Problem to solution |
|
|
202
|
+
| `funnel` | Conversion and filtering |
|
|
203
|
+
| `isometric-map` | Spatial relationships |
|
|
204
|
+
| `dashboard` | Metrics and KPIs |
|
|
205
|
+
| `periodic-table` | Categorised collections |
|
|
206
|
+
| `comic-strip` | Narratives and sequences |
|
|
207
|
+
| `story-mountain` | Plot structure and tension arcs |
|
|
208
|
+
| `jigsaw` | Interconnected parts |
|
|
209
|
+
| `venn-diagram` | Overlapping concepts |
|
|
210
|
+
| `winding-roadmap` | Journeys and milestones |
|
|
211
|
+
| `circular-flow` | Cycles and recurring processes |
|
|
212
|
+
| `dense-modules` | High-density, data-rich guides |
|
|
213
|
+
|
|
214
|
+
## Style gallery
|
|
215
|
+
|
|
216
|
+
| Style | Description |
|
|
217
|
+
| --- | --- |
|
|
218
|
+
| `craft-handmade` | Hand-drawn paper craft |
|
|
219
|
+
| `claymation` | 3D clay figures and stop-motion |
|
|
220
|
+
| `kawaii` | Japanese cute and pastels |
|
|
221
|
+
| `storybook-watercolor` | Soft painted and whimsical |
|
|
222
|
+
| `chalkboard` | Chalk on black board |
|
|
223
|
+
| `cyberpunk-neon` | Neon and futuristic |
|
|
224
|
+
| `bold-graphic` | Comic style and halftone |
|
|
225
|
+
| `aged-academia` | Vintage science and sepia |
|
|
226
|
+
| `corporate-memphis` | Flat vector and vibrant |
|
|
227
|
+
| `technical-schematic` | Blueprint and engineering |
|
|
228
|
+
| `origami` | Folded paper and geometry |
|
|
229
|
+
| `pixel-art` | Retro 8-bit |
|
|
230
|
+
| `ui-wireframe` | Grayscale interface mockup |
|
|
231
|
+
| `subway-map` | Transit diagram |
|
|
232
|
+
| `ikea-manual` | Minimal line art |
|
|
233
|
+
| `knolling` | Organised flat-lay |
|
|
234
|
+
| `lego-brick` | Toy brick construction |
|
|
235
|
+
| `pop-laboratory` | Blueprint grid and lab precision |
|
|
236
|
+
| `morandi-journal` | Warm muted doodle journal |
|
|
237
|
+
| `retro-pop-grid` | 1970s pop art and Swiss grid |
|
|
238
|
+
| `hand-drawn-edu` | Pastel educational drawing |
|
|
239
|
+
| `retro-popup-pop` | Vintage UI collage and flat pop colour |
|
|
240
|
+
|
|
241
|
+
A configured custom style uses its `prompt_fragment` directly, with no style file.
|