Files
opencode-skill/skills/image-edit/SKILL.md
2026-03-08 23:03:19 +07:00

64 lines
2.1 KiB
Markdown

---
name: image-edit
description: Edit images using AI with text prompts and input images. Use this skill when the user wants to modify or transform an existing image with AI editing.
---
# Image Edit
Edit images with AI by combining source images with text prompts via `python3 scripts/image_edit.py edit <prompt> <image_path> [options]`.
## Commands
| Command | Args | Description |
|---------|------|-------------|
| `edit` | `<prompt> <image_path> [--width W] [--height H] [--steps N] [--cfg-scale N]` | Edit image with prompt |
## Options
| Option | Default | Range | Description |
|--------|---------|-------|-------------|
| `--width` | 1024 | 128-2048 | Output image width in pixels |
| `--height` | 1024 | 128-2048 | Output image height in pixels |
| `--steps` | 40 | 5-100 | Number of inference steps |
| `--seed` | null | 0-4294967295 | Random seed (null = random) |
| `--cfg-scale` | 4 | 0-10 | True CFG scale for guidance |
| `--negative-prompt` | "" | - | Negative prompt to avoid |
## Examples
```bash
# Basic edit
python3 scripts/image_edit.py edit "make it look like oil painting" photo.jpg
# Style transfer
python3 scripts/image_edit.py edit "convert to anime style" portrait.png
# Object modification
python3 scripts/image_edit.py edit "change the car color to red" street.jpg --steps 50
# With negative prompt
python3 scripts/image_edit.py edit "add a sunset background" landscape.png --negative-prompt "water, ocean"
```
## Workflow
1. Provide a `prompt` describing the desired edit
2. Provide an `image_path` to the source image (PNG, JPG, etc.)
3. Script converts image to base64 and sends to API
4. Saves edited image as `edited_[timestamp].jpg`
5. Returns image path: `edited_1234567890.jpg [12345]`
## Output Format
- Success: `Image saved: filename.jpg [id]`
- Error: `Error: message` (to stderr)
- Images saved to current working directory as JPEG files
## Notes
- Requires `CHUTES_API_TOKEN` in environment
- Supports up to 3 input images (currently uses first image)
- Input file must be a valid image format (PNG, JPG, etc.)
- Output is always JPEG format to save memory
- Images are saved locally, not returned as base64 to save memory