AhmedAburady /
imagine-cli
Command-line tool for generating and editing images with Gemini and OpenAI models
- 65 stars
- 2 stars since 3 Oct
- Go
- Updated 44 days ago
- Beginner friendly
- Image, video & audio
Some of the best image models are mostly used through web pages. Imagine gives you a command, imagine -p "your prompt", that calls them directly through their APIs and saves the result as a PNG in your current folder. It supports Gemini, Vertex AI and OpenAI.
Setup is one config file at ~/.config/imagine/config.yaml, with no environment variables needed. You can add a provider with imagine providers add. For OpenAI you can use an API key, or sign in with a ChatGPT Plus, Pro or Team plan. The README says the subscription route uses an unpublished endpoint, so it may stop working. The API key is the stable fallback.
The same command generates or edits: add -i reference.png and it edits that image instead. You can also pass a YAML or JSON file to -p to run many jobs in parallel, each with its own prompt, provider and size. The README names its predecessor, banana-cli, which only supported Google's models. Imagine is built so new providers can be added as a directory under providers/.
What it does
Generate and edit in one command
-p with a prompt generates an image. Adding -i with a reference image switches the same command to edit mode.
Concurrent generation
-n 10 produces ten images in one run, so you can compare variations without waiting for each one.
Batch runs from a file
Point -p at a YAML or JSON file and every entry runs in parallel, with mixed providers, models and sizes. The file is validated before any request is sent, and a summary table is printed at the end.
Composable prompts
-p can be repeated, so you can join reusable prompt files and one-off text into a single prompt.
Flexible credentials
Keys can be literal, read from ${VAR} environment variables, or fetched from 1Password with op:// references. OpenAI can also use a ChatGPT subscription login.
What you could build
- Generate a set of image variations from one prompt with -n and keep the best.
- Edit an existing picture by passing it with -i and a short instruction.
- Run a YAML file of many scenes across Gemini and OpenAI in one command.
- Call image generation from shell scripts or CI jobs to produce reproducible image sets.
- Keep a library of style prompt files and mix them per run.
Get started
Install with Go 1.26 or later, or download a pre-built binary from Releases. Add a provider with your API key, then run a prompt. A timestamped PNG is saved in the current directory.
go install github.com/AhmedAburady/imagine-cli/cmd/imagine@latestimagine providers add gemini --api-key AIza-your-keyimagine -p "a cyberpunk city at night with neon lights"Commands are copied from the project's README. Read it on GitHub for the full setup.
More in Image, video & audio
VoiceStudio
Desktop app for cloning voices, dubbing video and dictating, run on your own machine
voicebox
Local voice studio for cloning voices, generating speech and dictating into any app
upscayl
Desktop app that enlarges low-resolution images using AI, on Linux, macOS and Windows