All skills
openai avatar

/imagegen

@0ebe69a official
by openaiopenai/skills28k stars
1,891

Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output should be a bitmap asset rather than repo-native code or vector. Do not use when the task is better handled by editing existing SVG/vector/code-native assets, extending an established icon or logo system, or building the visual directly in HTML/CSS/canvas.

Use this Skill: https://skilld.dev/gh/openai/skills/imagegen

This session only. Nothing lands on disk.

referencesprompting.md

≈1.6k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Prompting best practices

These prompting principles are shared by both top-level modes of the skill:

  • built-in image_gen tool (default)
  • explicit scripts/image_gen.py CLI fallback

This file is about prompt structure, specificity, and iteration. Fallback-only execution controls such as quality, input_fidelity, masks, output format, and output paths live in the fallback docs.

Contents

Structure

  • Use a consistent order: scene/backdrop -> subject -> key details -> constraints -> output intent.
  • Include intended use (ad, UI mock, infographic) to set the level of polish.
  • For complex requests, use short labeled lines instead of one long paragraph.

Specificity policy

  • If the user prompt is already specific and detailed, normalize it into a clean spec without adding creative requirements.
  • If the prompt is generic, you may add tasteful detail when it materially improves the output.
  • Treat examples in sample-prompts.md as fully-authored recipes, not as the default amount of augmentation to add to every request.

Allowed and disallowed augmentation

Allowed augmentation for generic prompts:

  • composition and framing cues
  • intended-use or polish-level hints
  • practical layout guidance
  • reasonable scene concreteness that supports the request

Do not add:

  • extra characters, props, or objects that are not implied
  • brand palettes, slogans, or story beats that are not implied
  • arbitrary side-specific placement unless the surrounding layout supports it

Composition and layout

  • Specify framing and viewpoint (close-up, wide, top-down) and placement only when it materially helps.
  • Call out negative space if the asset clearly needs room for UI or copy.
  • Avoid making left/right layout decisions unless the user or surrounding layout supports them.

Constraints and invariants

  • State what must not change (keep background unchanged).
  • For edits, say change only X; keep Y unchanged and repeat invariants on every iteration to reduce drift.

Text in images

  • Put literal text in quotes or ALL CAPS and specify typography (font style, size, color, placement).
  • Spell uncommon words letter-by-letter if accuracy matters.
  • For in-image copy, require verbatim rendering and no extra characters.

Input images and references

  • Do not assume that every provided image is an edit target.
  • Label each image by index and role (Image 1: edit target, Image 2: style reference).
  • If the user provides images for style, composition, or mood guidance and does not ask to modify them, treat the request as generation with references.
  • If the user asks to preserve an existing image while changing specific parts, treat the request as an edit.
  • For compositing, describe how the images interact (place the subject from Image 2 into Image 1).

Iterate deliberately

  • Start with a clean base prompt, then make small single-change edits.
  • Re-specify critical constraints when you iterate.
  • Prefer one targeted follow-up at a time over rewriting the whole prompt.

Fallback-only execution controls

  • quality, input_fidelity, explicit masks, output format, and output paths are fallback-only execution controls.
  • Do not assume they are built-in image_gen tool arguments.
  • If the user explicitly chooses CLI fallback, see references/cli.md and references/image-api.md for those controls.

Use-case tips

Generate:

  • photorealistic-natural: Prompt as if a real photo is captured in the moment; use photography language (lens, lighting, framing); call for real texture; avoid over-stylized polish unless requested.
  • product-mockup: Describe the product/packaging and materials; ensure clean silhouette and label clarity; if in-image text is needed, require verbatim rendering and specify typography.
  • ui-mockup: Describe the target fidelity first (shippable mockup or low-fi wireframe), then focus on layout, hierarchy, and practical UI elements; avoid concept-art language.
  • infographic-diagram: Define the audience and layout flow; label parts explicitly; require verbatim text.
  • logo-brand: Keep it simple and scalable; ask for a strong silhouette and balanced negative space; avoid decorative flourishes unless requested.
  • illustration-story: Define panels or scene beats; keep each action concrete.
  • stylized-concept: Specify style cues, material finish, and rendering approach (3D, painterly, clay) without inventing new story elements.
  • historical-scene: State the location/date and required period accuracy; constrain clothing, props, and environment to match the era.

Edit:

  • text-localization: Change only the text; preserve layout, typography, spacing, and hierarchy; no extra words or reflow unless needed.
  • identity-preserve: Lock identity (face, body, pose, hair, expression); change only the specified elements; match lighting and shadows.
  • precise-object-edit: Specify exactly what to remove/replace; preserve surrounding texture and lighting; keep everything else unchanged.
  • lighting-weather: Change only environmental conditions (light, shadows, atmosphere, precipitation); keep geometry, framing, and subject identity.
  • background-extraction: Request a clean cutout; crisp silhouette; no halos; preserve label text exactly; no restyling.
  • style-transfer: Specify style cues to preserve (palette, texture, brushwork) and what must change; add no extra elements to prevent drift.
  • compositing: Reference inputs by index; specify what moves where; match lighting, perspective, and scale; keep the base framing unchanged.
  • sketch-to-render: Preserve layout, proportions, and perspective; choose materials and lighting that support the supplied sketch without adding new elements.

Where to find copy/paste recipes

For copy/paste prompt specs (examples only), see references/sample-prompts.md. This file focuses on principles, specificity, and iteration patterns.

Source: SKILL.md on GitHub

1 warning16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    This skill provides capabilities for image generation and editing using a built-in tool or an explicit CLI fallback. A review of the files indicates that standard practices are followed, including secure handling of API keys via environment variables and path sanitization to avoid path traversal concerns.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer7mo

    6/9 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 0ebe69a. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Activeupdated 6 months ago
  • image-generation
  • ai-image
  • openai
  • asset-creation
  • photo-mockup
  • illustration
  • editing
  • texture
  • sprite

README badge

README badge for openai/skills/imagegen

Generates or edits bitmap images for projects using a built-in tool by default, with a fallback CLI mode available on request. Targets product mockups, website assets, UI mockups, game sprites, concept art, and image editing tasks like background removal or object replacement. Does not handle vector graphics, icon systems, or code-native visual assets.

Generated from the current SKILL.md.

Does this skill work with local image files?
Yes. For editing local files with the built-in tool, first load the image with the `view_image` tool so it appears in conversation context, then proceed with the edit. For direct file-path control and advanced parameters, use the explicit CLI fallback mode (which requires OPENAI_API_KEY) only when explicitly requested.
What's the difference between the built-in tool and the CLI fallback?
The built-in `image_gen` tool is the default for normal generation and editing; it does not require an API key. The CLI fallback (`scripts/image_gen.py`) offers subcommands like `generate-batch` and explicit parameters like masks and input fidelity, but only use it if you explicitly ask for the CLI path and set OPENAI_API_KEY.
Where are generated images saved by default?
Generated images are saved under `$CODEX_HOME/generated_images/` by default. For project-bound assets, they must be moved or copied into the workspace before finishing; do not leave project-referenced assets only at the default path.
Can I generate multiple image variants in one request?
Yes. In built-in mode, issue one `image_gen` call per variant. In explicit CLI mode, use the `generate-batch` subcommand if you need to generate many prompts at once.
Should I use this skill for SVG icons or logos that match existing repo code?
No. For icons, logos, or UI graphics that should match existing SVG/vector/code-native assets in the repo, edit those directly instead. Use this skill when you need raster output like photos, illustrations, sprites, mockups, or transparent-background cutouts.

Generated from the current SKILL.md. These answers refresh after source changes.