I built Imagies to give scripts and AI agents one place to do image work. It’s a Docker service for cropping, resizing, format conversion, contact sheets, text-to-image matching, object detection and local image generation. Send it a picture or a prompt over REST or MCP and get back an image or the analysis you asked for. I don’t need a fucking chatbot to write a paragraph about my screenshot when the job is to crop it.
This is the still-image member of the family. Audiolla handles audio, Flickies handles video, and Imagies handles the pictures. You can run it by itself. Aigate also uses it for local image generation, but you don’t need that entire stack just to resize a damn PNG.
Start the box, then give it a picture
docker run --rm --init --cap-drop=ALL \
--security-opt=no-new-privileges:true --read-only \
--tmpfs /tmp:rw,noexec,nosuid,size=256m \
--memory=12g --cpus=4 --pids-limit=512 \
-p 127.0.0.1:8000:8000 -v imagies:/data psyb0t/imagies:latestThat starts the CPU service in the foreground. Leave it running and open another terminal. Put a still PNG named example.png in your current directory. These requests upload it, fit it onto a 640 by 480 canvas, convert it to WebP and download the result:
IMAGE_ID=$(curl --fail-with-body http://localhost:8000/v1/images \
-H 'Content-Type: image/png' --data-binary @example.png | jq -r .id)
OUTPUT_ID=$(curl --fail-with-body http://localhost:8000/v1/images/transform \
-H 'Content-Type: application/json' \
-d "{\"image_id\":\"$IMAGE_ID\",\"width\":640,\"height\":480,\"fit\":\"pad\",\"format\":\"webp\"}" \
| jq -r .id)
curl --fail-with-body "http://localhost:8000/v1/images/$OUTPUT_ID" -o result.webpThe upload returns an ID, width, height and format. The transform returns a new ID. Keep passing IDs between operations and fetch the bytes when you need the file. An agent doesn’t have to drag a huge base64 blob through its context window every time it changes the picture. The image stays on disk under /data/images, in the volume you mounted.
A crop is not an inference job
Editing uses Pillow. It doesn’t load CLIP or Stable Diffusion to work out where the edge of a rectangle is. The transform can crop first with [x, y, width, height], then resize and encode as PNG, JPEG or WebP. Both width and height have to be supplied together.
contain shrinks within the bounds and preserves the aspect ratio. cover fills the canvas and cuts off the excess. pad keeps the entire image on an exact canvas. stretch ignores the aspect ratio, for when you absolutely need everyone in the photo to look like they got trapped in a lift door.
Montage takes between two and 32 image IDs and makes a PNG contact sheet. Set the columns and cell dimensions. That’s useful for reviewing screenshot candidates, comparing generated pictures or handing an agent one grid instead of a directory it has to open file by file.
Uploads accept PNG, JPEG and WebP stills, up to 20 MiB and 16 million pixels. They are orientation-corrected and re-encoded. Animated inputs are rejected. This is an image-processing service, not a byte-preserving backup of the original.
Which picture, and where in it?
CLIP matches pictures against text. Give POST /v1/images/match image IDs and queries such as “a bicycle” or “a kitchen” and it ranks the descriptions for each image by cosine similarity. That is a ranking score, not a probability, and it doesn’t produce a chat answer. You can use it to sort a pile of candidates without paying a vision-language model to narrate every bloody one.
docker run --rm -v imagies:/data psyb0t/imagies:latest \
python -m imagies.models clip
curl --fail-with-body http://localhost:8000/v1/images/match \
-H 'Content-Type: application/json' \
-d "{\"image_ids\":[\"$IMAGE_ID\"],\"queries\":[\"a bird\",\"a kitchen\"]}"YOLO answers the other question: where are the objects? POST /v1/images/detect returns labels, confidence scores and normalized bounding boxes. A caller can scale those boxes to pixel coordinates and use them for a crop. Bring a compatible YOLOv8 detection ONNX export at /data/models/yolo/model.onnx, with one class name per line in labels.txt beside it. The deployment guide specifies the tensor layout. Renaming some random model to model.onnx doesn’t make it compatible.
The NVIDIA build runs CLIP on CUDA when available. YOLO uses ONNX Runtime’s CPU provider in both images. For video, let Flickies extract timestamped frames and send the stills here. The two services have different jobs; neither needs to pretend it’s the other.
Generate on your own hardware
Stable-diffusion.cpp does the generation. The CPU catalog has SD Turbo and SDXL Turbo. The CUDA catalog adds SDXL Lightning, FLUX.1 Schnell and Juggernaut XI. Both Docker images include editing, vision and generation. Use psyb0t/imagies:latest-cuda with --gpus all for NVIDIA, with the NVIDIA Container Toolkit installed on the host.
Install the CPU weights into the same volume:
docker run --rm -v imagies:/data psyb0t/imagies:latest \
python -m imagies.models generation-cpuFor the larger catalog, use the CUDA image and generation-cuda. Gated downloads need HF_TOKEN after you’ve accepted the model’s terms. The downloader verifies new files against hashes. Installed weights are regular GGUF and safetensors files under /data/models/generation. You can mount weights you already own there instead of downloading another multi-gigabyte copy because a container wants its own special little directory.
curl --fail-with-body http://localhost:8000/v1/models
curl --fail-with-body http://localhost:8000/v1/images/generations \
-H 'Content-Type: application/json' \
-d '{"model":"imagies-sd-turbo","prompt":"a yellow teapot on a wooden table","size":"256x256","response_format":"b64_json"}' \
| jq -r '.data[0].b64_json' | base64 -d > teapot.pngUse the full model ID from the model list. The request uses the OpenAI-compatible image-generation shape. Once the weights are installed, the inference doesn’t need the network. You still need enough RAM or VRAM for the model; putting an HTTP endpoint in front of it doesn’t shrink the bastard.
Don’t leave every model squatting in memory
The generation engine keeps one model resident at a time. It unloads after five idle minutes by default. IDLE_TIMEOUT changes that; LOAD_TIMEOUT defaults to ten minutes. Engine discovery is at GET /v1/generation/engines. For the bundled sdcpp engine, PUT /v1/generation/engines/sdcpp/model loads the full model ID you give it. DELETE /v1/generation/engines/sdcpp/model unloads it, and DELETE /v1/generation/engines/sdcpp/active cancels generation. A busy unload can return 409.
Current main also adds two controls beyond the tagged 0.2.1 release. IMAGIES_MODEL_DOWNLOAD=startup fetches missing CLIP and generation weights before the API starts. on-demand fetches CLIP when the first match request needs it, or the selected generation model on first use. Existing files are reused; YOLO remains a supplied export. Unset the variable to keep manual installation.
That same development version adds POST /v1/unload for generation, CLIP and YOLO together. It stops the resident model processes while keeping the API up, reports what it released, and refuses with 409 during model work. A later request can start the worker again. Those changes are still marked unreleased in the changelog. Don’t point the command at an older image and call the resulting 404 a mystery.
Hand the agent the toolbox
Streamable HTTP MCP runs at /v1/mcp. The five tools are transform, montage, match, detect and generate. Editing and vision take the REST-shaped request inside spec. Generation takes the full model ID, prompt and optional size and returns one staged image. Uploading and downloading files still happens over REST.
Set IMAGIES_AUTH_TOKEN before allowing other clients to reach it. REST and MCP share that bearer token. If a reverse proxy or another container supplies a different host, add the exact host, including its port, to IMAGIES_MCP_ALLOWED_HOSTS. All authenticated callers share the staged files. A bearer token isn’t a separate private vault for every agent.
In Aigate, IMAGIES=1 or IMAGIES_CUDA=1 enables the corresponding service. Aigate exposes generation models as local-imagies-cpu-* and local-imagies-cuda-*. Its resource manager coordinates those requests with the other model services sharing the machine. Standalone Imagies is the smaller option when you just want the image tools. WTFPL covers the application; bundled components and weights retain their own licenses.
Get Imagies on GitHub. The full manual covers model installation, REST requests and MCP setup.