---
name: generate-image
slug: generate-image
version: 0.1.2
description: Generate images for requests to draw pictures, posters, illustrations, avatars, or other visual assets, including “给我生成一张汽车图片” and “画一只猫”.
category: integration
tags:
  - automation
  - integration
---

# Generate Image

Use the managed image-generation gateway to create image files in the user's workspace. This is a Skill capability, not a chat-model switch.

## Workflow

1. Turn the user's request into one self-contained image prompt. Preserve requested text, composition, style, colors, aspect ratio, and exclusions exactly. Ask a question only when a missing choice would materially change the result.
2. Run the bundled script from this skill's `rootDir`. Pass prompts through standard input so shell characters are never interpreted:

   ```bash
   python3 "<rootDir>/scripts/generate_image.py" --prompt-file - <<'PROMPT'
   <complete image prompt>
   PROMPT
   ```

3. Add `--size WIDTHxHEIGHT`, `--quality low|medium|high`, or `--count 2` only when the user requests them. If the requested dimensions are not native to the gateway, the script maps them to the closest supported aspect ratio. Generate one image by default and never generate more than four in one call.
4. Read the JSON printed by the script. On success, verify each returned `path` exists and give the user a short confirmation. Xigua registers the script's `artifacts` and shows them as chat attachments automatically, so do not rely on a workspace-relative Markdown image URL. On failure, report the script's error and do not claim that an image was created.

## Rules

- Do not request or reveal API keys. The script uses the instance's managed Soul Store gateway configuration.
- Load this skill directly for image requests. Do not call `ManageSkill list` merely to check whether it exists.
- Do not replace the current chat model with the image model.
- Save output only inside the workspace. Use `--output-dir` only for a workspace-relative destination.
- Do not paste base64 image data into chat or write it manually.
- This version generates new images only. Do not claim that source-image editing is supported.
