cli-anything-gimp
A stateful command-line interface for image editing, built on Pillow. Designed for AI agents and power users who need to create and manipulate images without a GUI.
Installation
This CLI is installed as part of the cli-anything-gimp package:
bash
pip install cli-anything-gimp
Prerequisites:
- Python 3.10+
- gimp is recommended for native batch rendering, but layered compositions can
still render through the built-in Pillow path when GIMP is unavailable or when
deferred operations are present
Usage
Basic Commands
bash
# Show help
cli-anything-gimp --help
# Start interactive REPL mode
cli-anything-gimp
# Create a new project
cli-anything-gimp project new -o project.json
# Run with JSON output (for agent consumption)
cli-anything-gimp --json project info -p project.json
REPL Mode
When invoked without a subcommand, the CLI enters an interactive REPL session:
bash
cli-anything-gimp
# Enter commands interactively with tab-completion and history
Command Groups
Project
Project management commands.
| Command | Description |
|---|
| Create a new project |
| Open an existing project |
| Save the current project |
| Show project information |
| List available canvas profiles |
| Print raw project JSON |
Layer
Layer management commands.
| Command | Description |
|---|
| Create a new blank layer |
| Add a layer from an image file |
| List all layers |
| Remove a layer by index |
| Duplicate a layer |
| Move a layer to a new position |
| Set a layer property (name, opacity, visible, mode, offset_x, offset_y); negative offsets are accepted naturally |
| Flatten all visible layers |
| Merge a layer with the one below it |
Canvas
Canvas operations.
| Command | Description |
|---|
| Show canvas information |
| Resize the canvas (without scaling content) |
| Scale the canvas and all content proportionally |
| Crop the canvas to a rectangle |
| Set the canvas color mode |
| Set the canvas DPI |
Filter Group
Filter management commands.
| Command | Description |
|---|
| List all available filters |
| Show details about a filter |
| Add a filter to a layer |
| Remove a filter by index |
| Set a filter parameter |
| List filters on a layer |
Media
Media file operations.
| Command | Description |
|---|
| Analyze an image file |
| List media files referenced in the project |
| Check that all referenced media files exist |
| Show histogram analysis of an image |
Export Group
Export/render commands.
| Command | Description |
|---|
| List export presets |
| Show preset details |
| Render the project to an image file; deferred draw ops are applied at render time |
Session
Session management commands.
| Command | Description |
|---|
| Show session status |
| Undo the last operation |
| Redo the last undone operation |
| Show undo history |
Draw
Drawing operations (applied at render time).
| Command | Description |
|---|
| Draw text on a layer (by converting it to a text layer) |
| Draw a rectangle (stored as drawing operation) |
Examples
Create a New Project
Create a new gimp project file.
bash
cli-anything-gimp project new -o myproject.json
# Or with JSON output for programmatic use
cli-anything-gimp --json project new -o myproject.json
Interactive REPL Session
Start an interactive session with undo/redo support.
bash
cli-anything-gimp
# Enter commands interactively
# Use 'help' to see available commands
# Use 'undo' and 'redo' for history navigation
Export Project
Export the project to a final output format.
bash
cli-anything-gimp --project myproject.json export render output.png --overwrite
Layered Composition Workflow
For overlay-heavy compositions:
bash
cli-anything-gimp --project poster.gimp-cli.json layer set 0 offset_x -48
cli-anything-gimp --project poster.gimp-cli.json layer set 0 offset_y 24
cli-anything-gimp --project poster.gimp-cli.json draw text --layer 0 --text "Launch Night" --x 96 --y 120 --size 72 --color "#f6f1e8"
cli-anything-gimp --project poster.gimp-cli.json export render output.png --overwrite
Notes:
- now accepts negative and values in both command mode and REPL mode.
- and are render-time operations. Treat the exported image, not only the project JSON, as the thing to review.
- For projects with deferred draw ops, expect the Pillow render path to be the stable default even if GIMP is installed.
State Management
The CLI maintains session state with:
- Undo/Redo: Up to 50 levels of history
- Project persistence: Save/load project state as JSON
- Session tracking: Track modifications and changes
Output Formats
All commands support dual output modes:
- Human-readable (default): Tables, colors, formatted text
- Machine-readable ( flag): Structured JSON for agent consumption
bash
# Human output
cli-anything-gimp project info -p project.json
# JSON output for agents
cli-anything-gimp --json project info -p project.json
For AI Agents
When using this CLI programmatically:
- Always use flag for parseable output
- Check return codes - 0 for success, non-zero for errors
- Parse stderr for error messages on failure
- Use absolute paths for all file operations
- Verify outputs exist after export operations
- Review rendered outputs after offset, draw, blend-mode, or filter changes instead of trusting saved project state alone
More Information
- Full documentation: See README.md in the package
- Test coverage: See TEST.md in the package
- Methodology: See HARNESS.md in the cli-anything-plugin
Version
1.0.0