Skip to content
Skills Library
Design & UX · Conversion & formats

edit-image

/edit-image

Edit, restyle, or vary an EXISTING image file using OpenAI gpt-image-2 through the Codex CLI — change one thing and keep the rest, swap a background, recolor to a brand palette, add or fix text, or produce style-matched variants of a reference image. Use whenever the user points at an image file and asks to change, fix, restyle, clean up, or make a version of it.

Licence
MIT
Last repository change
10.08.2026

Assessment and security

84/ 100Class: good
Format9 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 10.08.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Edit, restyle, or vary an EXISTING image file using OpenAI gpt-image-2 through the Codex CLI — change one thing and keep the rest, swap a background, recolor to a brand palette, add or fix text, or produce style-matched variants of a reference image. Use whenever the user points at an image file and asks to change, fix, restyle, clean up, or make a version of it.

Original author description

Edit, restyle, or vary an EXISTING image file using OpenAI gpt-image-2 through the Codex CLI — change one thing and keep the rest, swap a background, recolor to a brand palette, add or fix text, or produce style-matched variants of a reference image. Use whenever the user points at an image file and asks to change, fix, restyle, clean up, or make a version of it.

How it works

  1. Examples
  2. Writing the change description
  3. Rules
Original SKILL.md headings · 71 lines, 493 words
SKILL.md preview
---
description: Edit, restyle, or vary an EXISTING image file using OpenAI gpt-image-2 through the Codex CLI — change one thing and keep the rest, swap a background, recolor to a brand palette, add or fix text, or produce style-matched variants of a reference image. Use whenever the user points at an image file and asks to change, fix, restyle, clean up, or make a version of it.
---

# Edit an existing image (gpt-image-2 via Codex CLI)

Same wrapper as generation, plus `--ref` to attach the source image:

```bash
codex-imagegen "<what to change>" <output.png> --ref <source.png> [--size WxH]
```

The wrapper attaches the reference with `codex exec -i`, tells Codex to preserve
everything not mentioned, and prints the absolute path of the new file. **The
source file is never modified** — always write to a new path.

## Examples

```bash
# change one thing, keep the rest
codex-imagegen "change the sky to a sunset orange, keep the building and people identical" \
  ./out/hero-sunset.png --ref ./assets/hero.png

# recolor to a brand palette
codex-imagegen "recolor to a monochrome palette of #2563EB on white, keep the exact shapes" \
  ./out/icon-blue.png --ref ./assets/icon.png

# style-matched sibling asset
codex-imagegen "a settings gear icon in exactly the style of the reference: same stroke weight, same palette, same corner radius" \
  ./out/settings.png --ref ./assets/home.png
```

Up to four `--ref` images can be passed — useful when one is the subject and the
others are style references. Say in the prompt which is which.

## Writing the change description

Be surgical. The model preserves what you don't mention, so name the change and
then name what must survive it:

- Good: *"replace the text on the sign with 'OPEN 24/7', keep the font style, lighting and every other element identical"*
- Bad: *"make it better"* — produces an unrelated image

For a series of edits, chain them one at a time (each output becomes the next
`--ref`) rather than stacking five changes into one prompt.

## Rules

1. **Never overwrite the source.** Write to a new file; offer to replace only after
   the user has seen the result. Note that Codex itself resists overwriting — the
   wrapper prints the path actually written, which may be a versioned sibling like
   `out-v2.png`. Use the printed path, not the one you asked for.
2. **Verify by viewing.** Read the output PNG with the Read tool and compare
   against the request before reporting done. Regenerate with a sharper prompt if
   the model drifted — at most 2 retries.
3. **Use a Bash timeout of at least 300000 ms** (5 minutes).
4. **For a transparent result**, regenerate the subject on a flat `#00FF00`
   background (`#FF00FF` if the subject is green) and strip the key with the
   helper Codex ships:
   ```bash
   python "${CODEX_HOME:-$HOME/.codex}/skills/.system/imagegen/scripts/remove_chroma_key.py" \
     --input ./keyed.png --out ./final.png --auto-key border --soft-matte \
     --transparent-threshold 12 --opaque-threshold 220 --despill
   ```
   Verify transparent corners and no colour fringe afterwards. True native
   transparency needs Codex's CLI fallback plus an `OPENAI_API_KEY` — only raise
   that option for hard subjects (hair, fur, glass, smoke) and let the user decide.
5. **Not for precise pixel work.** Cropping, resizing, rotating, format conversion
   and compression are faster and lossless with ImageMagick or `sips` — use those
   directly instead of regenerating.
6. Each edit spends the user's ChatGPT plan quota. Don't loop unprompted.

For multi-image jobs, hand the whole brief to the `codex-artist` subagent instead.

Versions

The database has no other skills named edit-image.

Database snapshot: 13.11.2026 · package version e4a376f564af (SHA-256 digest of the entire package)

Downloads in the last 30 days: 4 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 95gpt-image-2
    Generate or edit a raster image with OpenAI's gpt-image-2 through the Codex CLI, billed to the ChatGPT subscription rather than an API key. Use whenever the user asks for a photo, illustration, mockup, texture, marketing visual, or an edit to an existing image file, including…
  • 100gpt-image-1-5
    Generate and edit images using OpenAI's GPT Image 1.5 model. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the…
  • 100gpt-image-2-skill
    This skill should be used when the user asks to "generate an image", "create a logo", "draw an icon", "edit this photo", "change background to transparent", "remove background", "use GPT image", "use Codex to draw", "用 GPT image 生成图片", "用 Codex 画图", "帮我生成一张图", "改成透明背景",…
  • 100gpt-image-skill
    Generate or edit images when the user names OpenAI, GPT Image, or a gpt-image model. Use the default image skill when no provider is named.
  • 100gpt-image-skill
    Generate or edit images using OpenAI GPT Image API (gpt-image-2, gpt-image-1, etc). Use ONLY when the user explicitly names OpenAI or GPT as the provider: "gpt image", "openai image", "generate image with openai", "用 openai 画图", "用 GPT 生成图片". For generic image requests without a…
  • 100codex-imagegen
    Generate or edit raster images (photos, illustrations, mockups, logos, product shots, game/UI assets, textures, infographics) using Codex's built-in image_gen tool — driven headlessly through `codex exec`. Billed via the user's ChatGPT/Codex login, so it needs NO OpenAI API key.…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.