Skip to main content

CLI tool for image editing and generation via Cloudflare Workers AI

Project description

imageflare

PyPI version Python versions License: MIT

A command-line tool for generating and editing images using Cloudflare Workers AI — directly from your terminal, no server required. Works on Windows, macOS, and Linux.

Features

  • Generate images from text prompts using state-of-the-art AI models
  • Edit existing images with a text prompt (img2img)
  • Multi-reference support — supply up to 3 additional reference images for style/content
  • Dynamic model list — fetches available models live from your Cloudflare account
  • Interactive config wizard — guided first-run setup for credentials and model selection
  • Spinner feedback, seed control, auto-open output, and configurable output path

Installation

Requirements: Python 3.8+ and a Cloudflare account with Workers AI access (free tier available).

macOS / Linux

pip install imageflare

Windows

pip install imageflare

Tip (Windows): If imageflare is not found after installing, your Python Scripts folder may not be on your PATH. Either use python -m imageflare as a drop-in replacement, or add the Scripts folder to your PATH:

  • Open Start → Edit the system environment variables → Environment Variables
  • Under User variables, edit Path and add %APPDATA%\Python\PythonXXX\Scripts

Using a virtual environment (recommended)

macOS / Linux
python3 -m venv .venv
source .venv/bin/activate
pip install imageflare
Windows (Command Prompt)
python -m venv .venv
.venv\Scripts\activate.bat
pip install imageflare
Windows (PowerShell)
python -m venv .venv
.venv\Scripts\Activate.ps1
pip install imageflare

Quick Start

The imageflare command works identically on all platforms:

# Step 1 — configure your credentials (one time)
imageflare config

# Generate an image from a prompt
imageflare generate --prompt "a red fox sitting on a snow-covered log"

# Edit an existing image
imageflare edit photo.jpg --prompt "make it look like a watercolor painting"

# Edit with a style reference image
imageflare edit photo.jpg --prompt "apply this style" --ref style.png

# Save to a specific path and open immediately after
imageflare generate --prompt "sunset over mountains" --output sunset.png --open

Configuration

Credentials are stored in a config file. The location varies by OS:

OS Config file location
Linux ~/.config/imageflare/config
macOS ~/.config/imageflare/config
Windows %APPDATA%\imageflare\config
imageflare config                     # interactive setup wizard
imageflare config show                # view current settings
imageflare config models              # list available AI models
imageflare config set --account-id YOUR_ID --api-token YOUR_TOKEN
imageflare config set --model "@cf/black-forest-labs/flux-1-schnell"

Getting credentials:

Credential Where to find it
Account ID Cloudflare dashboard → right sidebar of any page
API Token My Profile → API Tokens → Create Token — select the Workers AI template or grant Workers AI: Read permission

Commands

imageflare generate

Generate an image from a text prompt.

Usage: imageflare generate [OPTIONS]

Options:
  -p, --prompt TEXT     Description of the image to generate  [required]
  -m, --model TEXT      Cloudflare Workers AI model ID
      --width INTEGER   Output width in pixels  [default: 1024]
      --height INTEGER  Output height in pixels  [default: 1024]
      --seed INTEGER    Random seed for reproducible results
  -o, --output PATH     Output file path  [default: imageflare_<timestamp>.png]
      --open            Open the saved image automatically
  -h, --help            Show this message and exit

imageflare edit

Edit an existing image using a text prompt.

Usage: imageflare edit IMAGE_PATH [OPTIONS]

Arguments:
  IMAGE_PATH            Path to the input image  [required]

Options:
  -p, --prompt TEXT     Editing instruction  [required]
  -r, --ref PATH        Additional reference image (repeatable, up to 3)
  -m, --model TEXT      Cloudflare Workers AI model ID
      --width INTEGER   Output width in pixels  [default: 1024]
      --height INTEGER  Output height in pixels  [default: 1024]
      --seed INTEGER    Random seed for reproducible results
  -o, --output PATH     Output file path  [default: imageflare_<timestamp>.png]
      --open            Open the saved image automatically
  -h, --help            Show this message and exit

Windows path tip: Use forward slashes or wrap paths in quotes if they contain spaces:

imageflare edit "C:\Users\You\Pictures\photo.jpg" --prompt "turn it into a sketch"

imageflare config

Usage: imageflare config [COMMAND]

Commands:
  (no command)   Launch the interactive setup wizard
  show           Print current credentials and settings
  models         List all available Workers AI image models
  set            Update one or more settings non-interactively

Options for `config set`:
  --account-id TEXT   Cloudflare account ID
  --api-token TEXT    Cloudflare API token
  --model TEXT        Default model ID

Models

imageflare works with any Cloudflare Workers AI text-to-image model. Once credentials are configured, the live model list is fetched automatically from the API.

Run imageflare config models to see everything available on your account.

Default model: @cf/black-forest-labs/flux-2-klein-4b

How It Works

  1. You provide a prompt (and optionally an input image for editing)
  2. imageflare sends the request to the Cloudflare Workers AI REST API using your credentials
  3. The generated image is returned and saved locally — no intermediate servers, no data retained

Contributing

Issues and pull requests are welcome at github.com/Sallytion/Imageflare.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imageflare-1.0.1.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

imageflare-1.0.1-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file imageflare-1.0.1.tar.gz.

File metadata

  • Download URL: imageflare-1.0.1.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for imageflare-1.0.1.tar.gz
Algorithm Hash digest
SHA256 fcb38e32403baecf883a0e87bf2556a87e52bb62325d38147ffe50f4e64d27b2
MD5 16ce8ace68d6235ee7b8615812bc7771
BLAKE2b-256 e75fc84959a39719f0931cfe96777b719426a0726d4f803377f1f80b28f98c35

See more details on using hashes here.

Provenance

The following attestation bundles were made for imageflare-1.0.1.tar.gz:

Publisher: publish.yml on Sallytion/ImageFlare

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file imageflare-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: imageflare-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for imageflare-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4ecd2805a7b912284b523d5cba0ae89893d840a96e1f2b41c3ab0eaa0db3ccd5
MD5 305ddc9df6163e7ca71330f6a755491f
BLAKE2b-256 3f2858d91ec30745bc5ec1a42c6b6558c5fc177006f45abfd64065a06ca3095d

See more details on using hashes here.

Provenance

The following attestation bundles were made for imageflare-1.0.1-py3-none-any.whl:

Publisher: publish.yml on Sallytion/ImageFlare

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page