Generate or edit raster images (photos, illustrations, textures, sprites, mockups, logos, infographics) using the workspace's configured image-generation provid
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-image-generation-a72a24128d76 ,按照其中的说明把「image-generation」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
Generate or edit images for the current project (website assets, game assets,
UI and product mockups, wireframes, logos, photorealistic images, infographics)
using onyx-cli image. Generation runs server-side with whatever provider the
admin configured at /admin/configuration/image-generation (OpenAI, Gemini, or
Azure) — no API key is needed here.
If onyx-cli image … exits with "no image generation provider is configured",
stop and tell the user: image generation is unavailable until an admin
configures a provider at /admin/configuration/image-generation. Do not try to
work around it with another tool.
image edit.image generate.-n for distinct assets; -n produces variants of one prompt).Assume the user wants a new image unless they clearly ask to change an existing one.
onyx-cli image generate \
-p "A minimal hero of a ceramic coffee mug, clean product photography, soft studio lighting, wide composition with negative space, no text, no watermark" \
--shape landscape \
-o assets/hero.png
-i/--input-image may be repeated to composite multiple inputs; the first is the
primary edit source.
onyx-cli image edit \
-i assets/product.png \
-p "Replace only the background with a warm sunset gradient; keep the product and its edges unchanged" \
-o assets/product-sunset.png
Reference images are sent inline, and the sandbox egress proxy rejects any
request body over ~32 MiB with a "request body is larger than the limit"
(body_too_large) error. base64 inflates size by ~33%, so keep each -i image
roughly under ~20 MB on disk (downscale large source images first). This only
affects edit; plain generate has a tiny request body.
onyx-cli image generate -p "Abstract colorful album cover art" -n 3 -o art.png
-n > 1 requires a model that supports multiple images per request (e.g.
gpt-image-*). Some models (e.g. dall-e-3) only support -n 1 and will error
otherwise; if -n > 1 fails, retry with -n 1.
The command prints the saved file path(s), one per line (multiples get a _N
suffix). Open the output with view_image to inspect it and iterate with a
single targeted prompt change.
| Flag | Short | Applies to | Default | Description |
|---|---|---|---|---|
--prompt | -p | both | — | Text prompt / instruction (required). |
--output | -o | both | output.png | Output path; multiples get _N suffixes. |
--shape | — | both | square | square, portrait, or landscape. |
--quality | -q | both | provider default | Render quality (e.g. low/medium/high/auto). |
--num | -n | both | 1 | Variants of a single prompt. |
--input-image | -i | edit | — | Input image path; repeat to composite. |
generate vs edit) and execution (single vs repeated commands).onyx-cli image …, saving project-bound assets into the workspace. Don't overwrite an existing asset unless asked — use a sibling version (e.g. hero-v2.png).view_image the output; inspect subject, style, composition, and text accuracy; iterate with one targeted change.Use these labeled lines as scaffolding; include only the ones that help.
Use case: <photorealistic | product-mockup | ui-mockup | infographic | logo | illustration | concept-art | edit:object | edit:background | edit:style | compositing>
Asset type: <where the asset will be used>
Primary request: <main prompt>
Subject: <main subject>
Style/medium: <photo / illustration / 3D / etc.>
Composition/framing: <wide / close / top-down; placement>
Lighting/mood: <lighting + mood>
Color palette: <palette notes>
Text (verbatim): "<exact text>"
Constraints: <must keep / must avoid>
change only X; keep Y unchanged).