Grant Figure Assets
Workflow
Use this skill together with imagegen for proposal figure materials.
- Decide the asset strategy:
- For layout exploration, generate one full reference infographic first.
- For reusable HTML assets, prefer one icon per generation rather than cropping a gridded sheet when borders, labels, or uneven placement would contaminate crops.
- Use a gridded sheet only for rough style exploration or when the user explicitly wants a sheet.
- Generate raw images with
imagegen.
- Save raw outputs under a project-local directory such as
figs/icon_assets/<batch>_raw/.
- Do not leave project assets only under
$CODEX_HOME/generated_images.
- Tight-crop raw images with
scripts/tight_crop_assets.py.
- Use a white-background threshold to find the non-white bounding box.
- Save cropped assets under a sibling directory such as
figs/icon_assets/<batch>_tight/.
- Create a contact sheet for visual QA.
- Inspect the contact sheet with
view_image.
- Regenerate any asset whose concept is wrong, whose edges are cropped, or whose image has unwanted labels/borders.
- Re-run the crop script only for the changed assets or the whole raw folder.
- Report the saved paths and any assets that were intentionally superseded.
Prompt Rules
For JSPS/DC1-style monochrome assets:
- Use black line art on pure white background.
- Prefer crisp, print-safe, simple but recognizable illustrations over generic icon symbols.
- Ask for square canvas and no outer frame, no grid, no labels unless labels are intentionally part of the asset.
- State that the object should fill roughly 70-80% of the canvas with about 10% padding.
- For HTML reconstruction, keep text labels in HTML/CSS whenever possible and keep PNG assets label-free.
- If a generated sheet includes grid lines, labels, or inconsistent placement, switch to individual generation.
Single-object rule (mandatory for HTML reconstruction)
When the target figure will be reconstructed in HTML/CSS/SVG (as opposed to being
used as a standalone illustration), every PNG asset MUST be a single,
self-contained object. Do not pack a process or a flow into one PNG. This is the
most common failure mode for proposal figures and is non-negotiable.
Concretely:
- One asset = one object. If the concept involves "input → process → output",
it is three objects. Generate three separate PNGs (input object, process object,
output object) and let HTML add the arrows between them.
- No arrows inside the PNG. Arrows are layout, not content. They belong in
HTML/CSS/SVG, not in raster assets.
- No paired "before/after" depictions. A "compression" icon should not show
a big document next to a small document with an arrow. It should be either
the big document alone or the small document alone — pick one and generate
the other separately if needed.
- No composed scenes. "Brain reading a document" = brain + document =
two objects = two PNGs.
- No decorative satellites. An LLM icon should not be a brain with orbiting
atoms / sparkles / dotted halos. It should be just the brain (or just the
network graph) and nothing else.
- Style must match the existing batch. If the user references an existing
icon set (e.g.
01_pos_system.png ... 12_model_size_package.png), every new
asset must read at the same visual weight: same stroke width, same level of
detail, same "single recognizable noun" framing. Look at one or two of the
existing icons via view_image before drafting prompts.
If the user's asset list violates this rule (e.g. asks for "X → Y → Z" in one
icon), push back and propose a decomposed list before generating. Do not silently
generate a flow diagram and hope for the best — the resulting assets will be
unusable for HTML reconstruction and will need to be regenerated.
Reference figure scale check
If a reference figure is provided (e.g. a GPT Image 2 mockup of the target
infographic), measure how much pixel area each pictogram occupies in the
reference. Pictograms that occupy ~80×80 px in the reference must be generated
as simple, sparse symbols — not as fully-rendered illustrations scaled to
1024×1024 — because the generator will fill extra canvas with decorative
elements (arrows, sub-parts, orbital decorations) that break the single-object
rule. When in doubt, ask the generator for "sparse line art, 30%+ whitespace,
single centered symbol, no secondary elements."
Read references/prompts.md only when you need reusable prompt templates for full figures, icon sheets, or individual icon regeneration.
Cropping
Run the script with uv so Pillow does not need to be globally installed:
uv run --with pillow python /Users/yosuke/.codex/skills/grant-figure-assets/scripts/tight_crop_assets.py \
--input path/to/raw-assets \
--out-dir path/to/tight-assets \
--threshold 218 \
--contact-sheet
Useful options:
--padding 0: true bounding-box crop with no extra whitespace.
--padding 8: small margin for icons that visually need breathing room.
--square: center each crop on a square white canvas after tight cropping.
--max-size 1024: downscale long edges after cropping.
--threshold: pixels darker than this are treated as ink.
Use --threshold 218 as a default for generated white-background line art. Increase it if faint gray lines should count as ink; decrease it if background haze is being included.
Quality Checks
Before finishing, verify:
- No grid lines, crop guides, or sheet borders are present in individual assets.
- Important strokes are not cut off at the top, bottom, left, or right.
- The background is white and the asset is grayscale or black-and-white.
- The icon concept is specific enough for the proposal text, for example POS register rather than a generic database when the user asked for POS.
- The contact sheet makes all assets recognizable at the target display size.
1---2name: grant-figure-assets3description: Create reusable monochrome figure assets for Japanese academic grant proposals such as JSPS DC1. Use when Codex needs to generate an overview/reference figure or icon set with imagegen, save raw PNGs, tight-crop them by bounding box, make contact sheets, or prepare black-and-white assets for HTML/CSS/SVG reconstruction of proposal figures.4---56# Grant Figure Assets78## Workflow910Use this skill together with `imagegen` for proposal figure materials.11121. Decide the asset strategy:13 - For layout exploration, generate one full reference infographic first.14 - For reusable HTML assets, prefer one icon per generation rather than cropping a gridded sheet when borders, labels, or uneven placement would contaminate crops.15 - Use a gridded sheet only for rough style exploration or when the user explicitly wants a sheet.162. Generate raw images with `imagegen`.17 - Save raw outputs under a project-local directory such as `figs/icon_assets/<batch>_raw/`.18 - Do not leave project assets only under `$CODEX_HOME/generated_images`.193. Tight-crop raw images with `scripts/tight_crop_assets.py`.20 - Use a white-background threshold to find the non-white bounding box.21 - Save cropped assets under a sibling directory such as `figs/icon_assets/<batch>_tight/`.22 - Create a contact sheet for visual QA.234. Inspect the contact sheet with `view_image`.24 - Regenerate any asset whose concept is wrong, whose edges are cropped, or whose image has unwanted labels/borders.25 - Re-run the crop script only for the changed assets or the whole raw folder.265. Report the saved paths and any assets that were intentionally superseded.2728## Prompt Rules2930For JSPS/DC1-style monochrome assets:3132- Use black line art on pure white background.33- Prefer crisp, print-safe, simple but recognizable illustrations over generic icon symbols.34- Ask for square canvas and no outer frame, no grid, no labels unless labels are intentionally part of the asset.35- State that the object should fill roughly 70-80% of the canvas with about 10% padding.36- For HTML reconstruction, keep text labels in HTML/CSS whenever possible and keep PNG assets label-free.37- If a generated sheet includes grid lines, labels, or inconsistent placement, switch to individual generation.3839### Single-object rule (mandatory for HTML reconstruction)4041When the target figure will be reconstructed in HTML/CSS/SVG (as opposed to being42used as a standalone illustration), every PNG asset MUST be a single,43self-contained object. Do not pack a process or a flow into one PNG. This is the44most common failure mode for proposal figures and is non-negotiable.4546Concretely:4748- **One asset = one object.** If the concept involves "input → process → output",49 it is three objects. Generate three separate PNGs (input object, process object,50 output object) and let HTML add the arrows between them.51- **No arrows inside the PNG.** Arrows are layout, not content. They belong in52 HTML/CSS/SVG, not in raster assets.53- **No paired "before/after" depictions.** A "compression" icon should not show54 a big document next to a small document with an arrow. It should be either55 the big document alone or the small document alone — pick one and generate56 the other separately if needed.57- **No composed scenes.** "Brain reading a document" = brain + document =58 two objects = two PNGs.59- **No decorative satellites.** An LLM icon should not be a brain with orbiting60 atoms / sparkles / dotted halos. It should be just the brain (or just the61 network graph) and nothing else.62- **Style must match the existing batch.** If the user references an existing63 icon set (e.g. `01_pos_system.png` ... `12_model_size_package.png`), every new64 asset must read at the same visual weight: same stroke width, same level of65 detail, same "single recognizable noun" framing. Look at one or two of the66 existing icons via `view_image` before drafting prompts.6768If the user's asset list violates this rule (e.g. asks for "X → Y → Z" in one69icon), push back and propose a decomposed list before generating. Do not silently70generate a flow diagram and hope for the best — the resulting assets will be71unusable for HTML reconstruction and will need to be regenerated.7273### Reference figure scale check7475If a reference figure is provided (e.g. a GPT Image 2 mockup of the target76infographic), measure how much pixel area each pictogram occupies in the77reference. Pictograms that occupy ~80×80 px in the reference must be generated78as simple, sparse symbols — not as fully-rendered illustrations scaled to791024×1024 — because the generator will fill extra canvas with decorative80elements (arrows, sub-parts, orbital decorations) that break the single-object81rule. When in doubt, ask the generator for "sparse line art, 30%+ whitespace,82single centered symbol, no secondary elements."8384Read `references/prompts.md` only when you need reusable prompt templates for full figures, icon sheets, or individual icon regeneration.8586## Cropping8788Run the script with `uv` so Pillow does not need to be globally installed:8990```bash91uv run --with pillow python /Users/yosuke/.codex/skills/grant-figure-assets/scripts/tight_crop_assets.py \92 --input path/to/raw-assets \93 --out-dir path/to/tight-assets \94 --threshold 218 \95 --contact-sheet96```9798Useful options:99100- `--padding 0`: true bounding-box crop with no extra whitespace.101- `--padding 8`: small margin for icons that visually need breathing room.102- `--square`: center each crop on a square white canvas after tight cropping.103- `--max-size 1024`: downscale long edges after cropping.104- `--threshold`: pixels darker than this are treated as ink.105106Use `--threshold 218` as a default for generated white-background line art. Increase it if faint gray lines should count as ink; decrease it if background haze is being included.107108## Quality Checks109110Before finishing, verify:111112- No grid lines, crop guides, or sheet borders are present in individual assets.113- Important strokes are not cut off at the top, bottom, left, or right.114- The background is white and the asset is grayscale or black-and-white.115- The icon concept is specific enough for the proposal text, for example POS register rather than a generic database when the user asked for POS.116- The contact sheet makes all assets recognizable at the target display size.