imagine-cli
Original:🇺🇸 English
Translated
imagine is a multi-provider command-line tool for generating and editing images via Google Gemini, Google Vertex AI, and OpenAI (gpt-image-2).
9installs
Sourceahmedaburady/imagine-cli
Added on
NPX Install
npx skill4agent add ahmedaburady/imagine-cli imagine-cliTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →imagine CLI
imagine-p "..."-i reference.pngWhen to use
Use this skill whenever the user:
- Mentions the command, any of its flags, providers (gemini, vertex, openai), or model aliases (
imagine,gpt-image-2,pro,flash, etc.)1.5 - Wants to generate or edit images from the command line
- Is setting up the tool for the first time
- Hits an error they don't understand (most imagine errors are self-explanatory but the full list + fixes live in references/troubleshooting.md)
- Asks which provider to pick for a task
- References sizes (,
1K,2K,4K,1024x1024, etc.)3840x2160
Workflow
Always walk these three pre-flight steps before running an imagine command.
Step 1 — Is imagine installed?
bash
command -v imagine || echo NOT_INSTALLEDIf , decide the install method automatically — don't prompt the user to pick.
NOT_INSTALLEDDecision: check for Go first. If the user has Go, install from source (faster, keeps the binary up-to-date with on re-runs). Otherwise fall back to the pre-built binary.
go install …@latestbash
if command -v go >/dev/null 2>&1; then
go install github.com/AhmedAburady/imagine-cli/cmd/imagine@latest
else
# Detect platform, pick the matching release asset
case "$(uname -s)-$(uname -m)" in
Darwin-arm64) ASSET=imagine-darwin-arm64 ;;
Darwin-x86_64) ASSET=imagine-darwin-amd64 ;;
Linux-x86_64) ASSET=imagine-linux-amd64 ;;
Linux-aarch64|Linux-arm64) ASSET=imagine-linux-arm64 ;;
*) echo "Unsupported platform — download manually from https://github.com/AhmedAburady/imagine-cli/releases/latest"; exit 1 ;;
esac
curl -L -o imagine "https://github.com/AhmedAburady/imagine-cli/releases/latest/download/$ASSET"
chmod +x imagine
sudo mv imagine /usr/local/bin/imagine
fiAfter install, verify:
bash
imagine --versionWindows users: download (or ) from the releases page, rename to , and place on .
imagine-windows-amd64.exe-arm64.exeimagine.exe%PATH%Step 2 — Does the config file exist with at least one provider?
bash
cat ~/.config/imagine/config.yaml 2>/dev/null \
|| cat ~/.config/imagine/config.yml 2>/dev/null \
|| echo NO_CONFIGWindows path: .
%AppData%\imagine\config.yamlIf missing or the block is empty, walk the user through creating one. Full schema and per-provider credential setup in references/config.md. A ready-to-copy template sits at assets/config.example.yaml.
providers:Minimal Gemini-only example:
yaml
default_provider: gemini
providers:
gemini:
api_key: AIza-paste-key-hereStep 3 — Resolve the active provider
Every invocation runs under one active provider. Precedence:
imagine--provider <name> (CLI flag — highest)
↓
default_provider (config.yaml)
↓
first under providers: (alphabetical)
↓
errorimagine providers show[active][default]Common flags (every provider)
| Flag | Long | Purpose |
|---|---|---|
| | Prompt (required). Also accepts a file path. |
| | Output folder (default |
| | Output filename. Extension ( |
| | 1-20 images |
| | Reference image/folder, repeatable. Flips to edit mode. |
| | Use input filename for output (single |
| Per-invocation override |
Provider-specific flags
Flags that don't belong to the active provider are rejected with a clear error. Deep detail per provider:
- Gemini / Vertex → references/gemini.md. Flags: ,
-m pro/flash,-s 1K/2K/4K,-a aspect-ratio,-g grounding(flash only),-t thinking(gemini flash only).-I image-search - OpenAI → references/openai.md. Flags: ,
-m gpt-image-2 family,-s shorthand/raw WxH,-q quality,--compression,--moderation. Includes the full size matrix and edit-mode size restriction.--background
When the user is unsure which provider to pick:
- Photorealism, text rendering, intricate prompts → OpenAI
gpt-image-2 - Fast iteration, Google ecosystem, live-search grounding → Gemini or Vertex
- GCP-native auth / enterprise quotas → Vertex
Describe subcommand
bash
imagine describe -i photo.jpg # plain text
imagine describe -i ./styles/ -json -o style.json
imagine describe -i photo.jpg -vertex # Vertex backendGemini/Vertex only — describe doesn't support OpenAI. Needs either or configured. If the user has only OpenAI configured, describe prints friendly setup instructions (with for Vertex) and exits.
providers.gemini.api_keyproviders.vertex.provider_options.gcp_projectgcloud auth application-default loginExamples
bash
# Generate (active provider from config)
imagine -p "a sunset over mountains"
# Batch with size + aspect (Gemini/Vertex)
imagine -p "cityscape" -n 3 -s 2K -a 16:9 -o ./city
# OpenAI — fast draft
imagine -p "logo idea" --provider openai -q low
# OpenAI — 4K hero banner as JPEG
imagine -p "hero banner" --provider openai -s 3840x2160 -q high -f hero.jpg
# Edit, keep input filename
imagine -p "add rain" -i photo.png -r
# Multi-reference edit (OpenAI supports up to 16 refs/call)
imagine -p "gift basket of these" --provider openai \
-i lotion.png -i candle.png -i soap.png
# Vertex — same flags as Gemini, different auth
imagine -p "a cat" --provider vertex -n 3For more, run — provider-aware help surfaces the active provider's flags and a tailored EXAMPLES block.
imagine --helpAnti-patterns — do NOT do these
- Never suggest ,
GEMINI_API_KEY, or any env var for credentials. imagine does not read env vars. Config file only.OPENAI_API_KEY - Never suggest — those commands don't exist. Users edit
imagine config set-*directly.config.yaml - Never use ,
-ar,-isas single-dash flags. They're-vertex,--aspect-ratio,--image-search. (Describe keeps its own legacy--provider vertexflag — the exception.)-vertex - Never combine with
--background transparent. Unsupported — usegpt-image-2.-m 1.5 - Never combine with
-f— mutually exclusive.-r - Never suggest for the describe subcommand. Describe is Gemini/Vertex only.
--provider openai
Troubleshooting
When imagine errors, read references/troubleshooting.md before guessing. Covers every error message the CLI can produce with its specific fix.