imagegen by openai/skills
npx skills add https://github.com/openai/skills --skill imagegen为当前项目生成或编辑图像(例如网站素材、游戏素材、UI 模型、产品模型、线框图、Logo 设计、照片级真实感图像或信息图表)。
此技能严格包含两种顶层模式:
image_gen 工具。不需要 OPENAI_API_KEY。scripts/image_gen.py CLI。仅在用户明确要求使用 CLI 路径时使用。需要 OPENAI_API_KEY。仅在显式调用 CLI 备用模式时,CLI 暴露三个子命令:
generateeditgenerate-batch规则:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
image_gen 工具处理所有常规图像生成和编辑请求。OPENAI_API_KEY。仅在用户明确要求使用该备用模式时继续。scripts/image_gen.py 工作流。不要创建一次性的 SDK 运行器。scripts/image_gen.py。如果缺少某些功能,在采取其他操作前先询问用户。内置保存路径策略:
$CODEX_HOME/* 下。image_gen 工具上的目标路径参数(如果有)。如果需要特定位置,先生成图像,然后将选定的输出从 $CODEX_HOME/generated_images/... 移动或复制到该位置。$CODEX_HOME/* 路径。$CODEX_HOME/* 路径。hero-v2.png 或 item-icon-edited.png。两种模式共享的提示词指导位于 references/prompting.md 和 references/sample-prompts.md。
仅限备用模式的 CLI 模式文档/资源:
references/cli.mdreferences/image-api.mdreferences/codex-network.mdscripts/image_gen.py思考两个独立的问题:
意图:
内置编辑语义:
view_image 工具加载它,使图像在对话上下文中可见,然后继续内置编辑流程。执行策略:
image_gen 调用来生成多个素材或变体。generate-batch 子命令。除非用户明确要求更改现有图像,否则假定用户需要新图像。
generate 或 edit。generate-batch。view_image 检查它,以便图像在对话上下文中可用。image_gen 而不是替换为 SVG/HTML/CSS 占位符。如果请求的是图标、Logo 或 UI 图形,且需要匹配仓库中原有的 SVG/矢量/代码素材,则优先直接编辑这些素材。image_gen 工具。input_fidelity、蒙版、输出格式、输出路径和网络设置。$CODEX_HOME/generated_images/... 路径。$CODEX_HOME/generated_images/... 路径。将用户提示词重新格式化为结构化的、面向生产的规格说明。使用户的目标更清晰、更具可操作性,但不要盲目添加细节。
将此视为提示词塑造指导,而非封闭式模式。仅使用有帮助的部分,并在能实质性提高清晰度时添加简短的额外标注行。
根据用户提示词的具体性来决定增强的适当程度:
允许的增强:
不允许的增强:
将每个请求归类到以下类别之一,并在提示词和参考中保持标识符一致。
生成:
编辑:
使用以下带标签的规格说明作为两种顶层模式的共享提示词脚手架:
Use case: <taxonomy slug>
Asset type: <where the asset will be used>
Primary request: <user's main prompt>
Input images: <Image 1: role; Image 2: role> (optional)
Scene/backdrop: <environment>
Subject: <main subject>
Style/medium: <photo/illustration/3D/etc>
Composition/framing: <wide/close/top-down; placement>
Lighting/mood: <lighting + mood>
Color palette: <palette notes>
Materials/textures: <surface details>
Text (verbatim): "<exact text>"
Constraints: <must keep/must avoid>
Avoid: <negative constraints>
注意:
Asset type 和 Input images 是提示词脚手架,不是专用的 CLI 标志。Scene/backdrop 指的是视觉环境。它与备用 CLI 的 background 参数不同,后者控制输出透明度行为。Quality:、Input fidelity:、蒙版、输出格式和输出路径,仅属于显式的 CLI 路径。不要将它们视为内置 image_gen 工具的参数。增强规则:
仅更改 X;保持 Y 不变)。Use case: product-mockup
Asset type: landing page hero
Primary request: a minimal hero image of a ceramic coffee mug
Style/medium: clean product photography
Composition/framing: wide composition with usable negative space for page copy if needed
Lighting/mood: soft studio lighting
Constraints: no logos, no text, no watermark
Use case: precise-object-edit
Asset type: product photo background replacement
Primary request: replace only the background with a warm sunset gradient
Constraints: change only the background; keep the product and its edges unchanged; no text; no watermark
references/cli.md 和 references/image-api.md 了解 quality、input_fidelity、蒙版、输出格式和输出路径指导。两种模式共享的更多原则:references/prompting.md。两种模式共享的复制/粘贴规格说明:references/sample-prompts.md。
素材类型模板(网站素材、游戏素材、线框图、Logo)已整合在 references/sample-prompts.md 中。
这些约定仅适用于显式的 CLI 备用模式。它们不描述内置 image_gen 的输出行为。
tmp/imagegen/ 存放中间文件(例如 JSONL 批次);完成后删除它们。output/imagegen/ 下。--out 或 --out-dir 控制输出路径;保持文件名稳定且具有描述性。在此仓库中,优先使用 uv 进行依赖管理。
必需的 Python 包:
uv pip install openai
仅用于缩小的可选包:
uv pip install pillow
可移植性说明:
uv pip install ... 仍然是首选路径。OPENAI_API_KEY 必须为实时 API 调用设置。image_gen 工具时,不要向用户询问 OPENAI_API_KEY。如果缺少密钥,请向用户提供以下步骤:
OPENAI_API_KEY 设置为环境变量。如果在此环境中无法安装,请告知用户缺少哪个依赖项以及如何将其安装到其活动环境中。
references/cli.mdreferences/image-api.mdreferences/codex-network.mdreferences/prompting.md:两种模式共享的提示词原则。references/sample-prompts.md:两种模式共享的复制/粘贴提示词配方。references/cli.md:通过 scripts/image_gen.py 进行的仅限备用模式的 CLI 使用。references/image-api.md:仅限备用模式的 API/CLI 参数参考。references/codex-network.md:仅限备用模式的 CLI 模式网络/沙盒故障排除。scripts/image_gen.py:仅限备用模式的 CLI 实现。除非用户明确选择 CLI 模式,否则不要加载或使用它。每周安装次数
602
仓库
GitHub 星标数
15.3K
首次出现
2026 年 1 月 28 日
安全审计
安装于
codex541
opencode516
gemini-cli497
github-copilot486
cursor474
kimi-cli465
Generates or edits images for the current project (for example website assets, game assets, UI mockups, product mockups, wireframes, logo design, photorealistic images, or infographics).
This skill has exactly two top-level modes:
image_gen tool for normal image generation and editing. Does not require OPENAI_API_KEY.scripts/image_gen.py CLI. Use only when the user explicitly asks for the CLI path. Requires OPENAI_API_KEY.Within the explicit CLI fallback only, the CLI exposes three subcommands:
generateeditgenerate-batchRules:
image_gen tool by default for all normal image generation and editing requests.OPENAI_API_KEY. Proceed only if the user explicitly asks for that fallback.scripts/image_gen.py workflow. Do not create one-off SDK runners.scripts/image_gen.py. If something is missing, ask the user before doing anything else.Built-in save-path policy:
$CODEX_HOME/* by default.image_gen tool. If a specific location is needed, generate first and then move or copy the selected output from $CODEX_HOME/generated_images/....$CODEX_HOME/* path.$CODEX_HOME/* path.hero-v2.png or item-icon-edited.png.Shared prompt guidance for both modes lives in references/prompting.md and references/sample-prompts.md.
Fallback-only docs/resources for CLI mode:
references/cli.mdreferences/image-api.mdreferences/codex-network.mdscripts/image_gen.pyThink about two separate questions:
Intent:
Built-in edit semantics:
view_image tool so the image is visible in the conversation context, then proceed with the built-in edit flow.Execution strategy:
image_gen call per requested asset or variant.generate-batch subcommand only when the user explicitly chose CLI mode and needs many prompts/assets.Assume the user wants a new image unless they clearly ask to change an existing one.
generate or edit.generate-batch.view_image first so the image is available in conversation context.image_gen rather than substituting SVG/HTML/CSS placeholders. If the request is for an icon, logo, or UI graphic that should match existing repo-native SVG/vector/code assets, prefer editing those directly instead.Reformat user prompts into a structured, production-oriented spec. Make the user's goal clearer and more actionable, but do not blindly add detail.
Treat this as prompt-shaping guidance, not a closed schema. Use only the lines that help, and add a short extra labeled line when it materially improves clarity.
Use the user's prompt specificity to decide how much augmentation is appropriate:
Allowed augmentations:
Not allowed augmentations:
Classify each request into one of these buckets and keep the slug consistent across prompts and references.
Generate:
Edit:
Use the following labeled spec as shared prompt scaffolding for both top-level modes:
Use case: <taxonomy slug>
Asset type: <where the asset will be used>
Primary request: <user's main prompt>
Input images: <Image 1: role; Image 2: role> (optional)
Scene/backdrop: <environment>
Subject: <main subject>
Style/medium: <photo/illustration/3D/etc>
Composition/framing: <wide/close/top-down; placement>
Lighting/mood: <lighting + mood>
Color palette: <palette notes>
Materials/textures: <surface details>
Text (verbatim): "<exact text>"
Constraints: <must keep/must avoid>
Avoid: <negative constraints>
Notes:
Asset type and Input images are prompt scaffolding, not dedicated CLI flags.Scene/backdrop refers to the visual setting. It is not the same as the fallback CLI background parameter, which controls output transparency behavior.Quality:, Input fidelity:, masks, output format, and output paths belong in the explicit CLI path only. Do not treat them as built-in image_gen tool arguments.Augmentation rules:
change only X; keep Y unchanged).Use case: product-mockup
Asset type: landing page hero
Primary request: a minimal hero image of a ceramic coffee mug
Style/medium: clean product photography
Composition/framing: wide composition with usable negative space for page copy if needed
Lighting/mood: soft studio lighting
Constraints: no logos, no text, no watermark
Use case: precise-object-edit
Asset type: product photo background replacement
Primary request: replace only the background with a warm sunset gradient
Constraints: change only the background; keep the product and its edges unchanged; no text; no watermark
references/cli.md and references/image-api.md for quality, input_fidelity, masks, output format, and output-path guidance.More principles shared by both modes: references/prompting.md. Copy/paste specs shared by both modes: references/sample-prompts.md.
Asset-type templates (website assets, game assets, wireframes, logo) are consolidated in references/sample-prompts.md.
These conventions apply only to the explicit CLI fallback. They do not describe built-in image_gen output behavior.
tmp/imagegen/ for intermediate files (for example JSONL batches); delete them when done.output/imagegen/.--out or --out-dir to control output paths; keep filenames stable and descriptive.Prefer uv for dependency management in this repo.
Required Python package:
uv pip install openai
Optional for downscaling only:
uv pip install pillow
Portability note:
uv pip install ... remains the preferred path.OPENAI_API_KEY must be set for live API calls.OPENAI_API_KEY when using the built-in image_gen tool.If the key is missing, give the user these steps:
OPENAI_API_KEY as an environment variable in their system.If installation is not possible in this environment, tell the user which dependency is missing and how to install it into their active environment.
references/cli.mdreferences/image-api.mdreferences/codex-network.mdreferences/prompting.md: shared prompting principles for both modes.references/sample-prompts.md: shared copy/paste prompt recipes for both modes.references/cli.md: fallback-only CLI usage via scripts/image_gen.py.references/image-api.md: fallback-only API/CLI parameter reference.references/codex-network.md: fallback-only network/sandbox troubleshooting for CLI mode.scripts/image_gen.py: fallback-only CLI implementation. Do not load or use it unless the user explicitly chooses CLI mode.Weekly Installs
602
Repository
GitHub Stars
15.3K
First Seen
Jan 28, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex541
opencode516
gemini-cli497
github-copilot486
cursor474
kimi-cli465
AI Elements:基于shadcn/ui的AI原生应用组件库,快速构建对话界面
53,500 周安装
image_gen tool by default.input_fidelity, masks, output format, output paths, and network setup.$CODEX_HOME/generated_images/... path.$CODEX_HOME/generated_images/... path.