Native Transparent ImageGen
Generate the asset with native alpha. Treat a visible checkerboard, a prompt that says
"transparent," and a successful tool call as unverified until the original file passes
alpha inspection.
Keep the boundary strict
- Use this skill only for a newly generated asset whose deliverable must contain native
transparency.
- Treat supplied images as identity, subject, composition, or medium references unless the
user explicitly requests an edit.
- Do not invoke background removal, segmentation, chroma-key extraction, masks, or local
alpha synthesis to rescue an opaque output.
- Do not call a rendered checkerboard "transparent." An RGB checkerboard is a failed asset.
- If the user instead wants a background removed from an existing opaque image, route to a
background-extraction workflow and disclose that it is an edit, not native generation.
Generate conservatively
- Preserve the user's subject, identity, style, composition, and text constraints.
- Add one concise output requirement: return a PNG or WebP whose area outside the subject
is genuine pixel transparency with a real alpha channel.
- With a prompt-only built-in image tool, issue native-alpha deliverables one at a time.
Do not parallelize unless the current tool exposes an explicit per-request background
control and concurrent native-alpha behavior has been verified.
- When the user explicitly chooses an API path that exposes output controls, request
background: "transparent" and output_format: "png" or "webp".
- Preserve the original returned bytes. Validation must not rewrite, optimize, composite,
resize, or otherwise alter the deliverable.
Read references/prompting-and-retry.md when preparing a
prompt, retrying a failed output, generating more than one asset, or reporting limitations.
Validate the untouched file
Install the validator dependency only when it is missing:
python3 -m pip install -r \
"${CODEX_HOME:-$HOME/.codex}/skills/native-transparent-imagegen/scripts/requirements.txt"
Run the read-only validator on every requested deliverable:
python3 \
"${CODEX_HOME:-$HOME/.codex}/skills/native-transparent-imagegen/scripts/validate_alpha.py" \
--require-transparent-corners \
/path/to/original-output.png
The file passes the technical gate only when:
- its decoded pixels contain an alpha channel;
- at least one pixel is fully transparent and at least one is visible;
- required padding corners are transparent when the asset is meant to be isolated; and
- the validator exits successfully on the original output.
Then inspect the actual edges against contrasting viewer backgrounds. Alpha metadata cannot
prove that fine fur is clean or that the image lacks a broad translucent haze. Reject visible
checkerboards, matte halos, colored fog, unintended shadows, clipped strands, or missing
details even when the metadata gate passes.
Retry without faking success
- On an RGB or opaque output, keep all subject invariants and retry only the native-alpha
output instruction.
- Make at most three total generation attempts per distinct asset unless the user requests
more.
- Validate after every attempt. Do not edit the failed image into compliance.
- If all attempts fail, stop and report the original modes and validation failures. Offer an
explicit API route only when available and authorized; never silently change models or use
background extraction.
Report evidence
For every accepted asset, report:
- generation route and model when known;
- original file path, format, dimensions, mode, and SHA-256;
- alpha extrema, fully transparent pixel count, corner alpha values, and validator verdict;
- visual edge-QA result; and
- the exact final prompt or the native-alpha clause added to the user's prompt.
Keep generated, alpha-validated, edge-inspected, user-accepted, and published as
separate states.
1---2name: native-transparent-imagegen3description: Generate new raster assets that must contain native pixel transparency, then verify the untouched PNG or WebP before delivery. Use for transparent stickers, sprites, character cutouts, product assets, and furry or fine-edged subjects where background removal would be unacceptable. Do not use to remove a background from an existing opaque image, repair an opaque generation by masking or chroma key, or create ordinary opaque images.4---5
6# Native Transparent ImageGen
7
8Generate the asset with native alpha. Treat a visible checkerboard, a prompt that says
9"transparent," and a successful tool call as unverified until the original file passes
10alpha inspection.
11
12## Keep the boundary strict
13
14- Use this skill only for a newly generated asset whose deliverable must contain native
15 transparency.
16- Treat supplied images as identity, subject, composition, or medium references unless the
17 user explicitly requests an edit.
18- Do not invoke background removal, segmentation, chroma-key extraction, masks, or local
19 alpha synthesis to rescue an opaque output.
20- Do not call a rendered checkerboard "transparent." An RGB checkerboard is a failed asset.
21- If the user instead wants a background removed from an existing opaque image, route to a
22 background-extraction workflow and disclose that it is an edit, not native generation.
23
24## Generate conservatively
25
261. Preserve the user's subject, identity, style, composition, and text constraints.
272. Add one concise output requirement: return a PNG or WebP whose area outside the subject
28 is genuine pixel transparency with a real alpha channel.
293. With a prompt-only built-in image tool, issue native-alpha deliverables one at a time.
30 Do not parallelize unless the current tool exposes an explicit per-request background
31 control and concurrent native-alpha behavior has been verified.
324. When the user explicitly chooses an API path that exposes output controls, request
33 `background: "transparent"` and `output_format: "png"` or `"webp"`.
345. Preserve the original returned bytes. Validation must not rewrite, optimize, composite,
35 resize, or otherwise alter the deliverable.
36
37Read [references/prompting-and-retry.md](references/prompting-and-retry.md) when preparing a
38prompt, retrying a failed output, generating more than one asset, or reporting limitations.
39
40## Validate the untouched file
41
42Install the validator dependency only when it is missing:
43
44```sh
45python3 -m pip install -r \
46 "${CODEX_HOME:-$HOME/.codex}/skills/native-transparent-imagegen/scripts/requirements.txt"
47```
48
49Run the read-only validator on every requested deliverable:
50
51```sh
52python3 \
53 "${CODEX_HOME:-$HOME/.codex}/skills/native-transparent-imagegen/scripts/validate_alpha.py" \
54 --require-transparent-corners \
55 /path/to/original-output.png
56```
57
58The file passes the technical gate only when:
59
60- its decoded pixels contain an alpha channel;
61- at least one pixel is fully transparent and at least one is visible;
62- required padding corners are transparent when the asset is meant to be isolated; and
63- the validator exits successfully on the original output.
64
65Then inspect the actual edges against contrasting viewer backgrounds. Alpha metadata cannot
66prove that fine fur is clean or that the image lacks a broad translucent haze. Reject visible
67checkerboards, matte halos, colored fog, unintended shadows, clipped strands, or missing
68details even when the metadata gate passes.
69
70## Retry without faking success
71
72- On an RGB or opaque output, keep all subject invariants and retry only the native-alpha
73 output instruction.
74- Make at most three total generation attempts per distinct asset unless the user requests
75 more.
76- Validate after every attempt. Do not edit the failed image into compliance.
77- If all attempts fail, stop and report the original modes and validation failures. Offer an
78 explicit API route only when available and authorized; never silently change models or use
79 background extraction.
80
81## Report evidence
82
83For every accepted asset, report:
84
85- generation route and model when known;
86- original file path, format, dimensions, mode, and SHA-256;
87- alpha extrema, fully transparent pixel count, corner alpha values, and validator verdict;
88- visual edge-QA result; and
89- the exact final prompt or the native-alpha clause added to the user's prompt.
90
91Keep `generated`, `alpha-validated`, `edge-inspected`, `user-accepted`, and `published` as
92separate states.