ceveyne's profile picture
ceveyne

process-image

Public

LM Studio plugin and local stdio MCP entrypoint made for Bionic. A collection of tools for precise, mask-based editing tasks. Especially useful with `detect_objects` from the plugin `analyse-image`, which can automatically provide bounding boxes for detected objects.

554 Downloads

7 stars

2 forks

README

process-image

An LM Studio plugin and local stdio MCP entrypoint made for Bionic that gives your agent precise image-editing tools: cropping, masking, AI-powered zoom-in, inpainting, and outpainting — all via Draw Things.

Looking for the MCP-settings for Bionic? https://lmstudio.ai/ceveyne/process-image/files/README_MCP.md

Table of Contents

Tools

crop

Removes a specified amount from any side of an image and saves the result as a new variant in the chat working directory. No AI inference is involved — this is a pure pixel operation.

Crop amounts can be expressed as percentages (default) or absolute pixels (append px, e.g. 120px).

Integration with detect_object: When the analyse-image plugin has run detect_object on an image, crop can use the resulting bounding box directly. Set detectLabel to the object label and crop will automatically derive all four crop sides from the detection result. This skips the iterative procedure entirely and produces a precisely framed crop in a single call.

Parameters

ParameterTypeDescription
canvasstringSource image. Notation: a1, v2, p1, i3. Shorthand: a → a1, i → i1.
cropLeftnumber / stringAmount to remove from the left. Default unit: % (0–99). Append px for absolute pixels. Default: 0.
cropRightnumber / stringAmount to remove from the right. Same units. Default: 0.
cropTopnumber / stringAmount to remove from the top. Same units. Default: 0.
cropBottomnumber / stringAmount to remove from the bottom. Same units. Default: 0.
imageFormatstringEnforce a target aspect ratio: square (1:1), landscape (4:3), portrait (3:4), 16:9. Ignored when all four sides are explicitly given.
detectLabelstringCrop to the bounding box of a detected object by label. Requires a prior detect_object run.
detectIndexnumberZero-based index to select among multiple detections with the same label. Default: 0.
frameAdjustnumber / stringExpand (positive) or shrink (negative) the detection bounding box before cropping. Number: % of min(W,H). String with px suffix: absolute pixels.

Constraint: cropLeft + cropRight < 100, cropTop + cropBottom < 100 (when using percentage values).

Without detect_object — the iterative procedure: Adjust one axis at a time (left → right → top → format) and inspect after each step. At tight crops, 1–3% per step is enough. Symmetric values do not guarantee a centred subject — judge by visual gap, not numbers.

mask

Draws a cyan bounding box on an image to define the region of interest for inpaint or outpaint. No AI inference is involved — this is a pure annotation step.

Pass the mask result as canvas to inpaint or outpaint; the masked region is picked up automatically.

Integration with detect_object: mask accepts detectLabel / detectIndex / frameAdjust to place the bounding box directly on a detected object without manual crop values.

Parameters

ParameterTypeDescription
canvasstringSource image. Same notation as crop.
cropLeftnumber / stringAmount to remove from the left when defining the mask region. Same units as crop.
cropRightnumber / stringAmount to remove from the right. Same units.
cropTopnumber / stringAmount to remove from the top. Same units.
cropBottomnumber / stringAmount to remove from the bottom. Same units.
imageFormatstringTarget aspect ratio for the mask region. Same values as crop.
detectLabelstringPlace the mask on a detected object's bounding box. Requires a prior detect_object run.
detectIndexnumberZero-based index when multiple detections share the same label. Default: 0.
frameAdjustnumber / stringExpand or shrink the detection box before masking. Same semantics as crop.

zoom-in

Crops a region of an image and re-renders it at full canvas resolution using Draw Things image2image (edit) mode. Transforms a low-fidelity crop into a high-resolution result.

The most efficient workflow is to run crop first (which stores the crop parameters in the session state), then call zoom-in on the same canvas without repeating the crop values — zoom-in reads them automatically.

Integration with detect_object: Like crop, zoom-in accepts detectLabel / detectIndex / frameAdjust to target a detected object directly, without a prior crop step.

Parameters

ParameterTypeDescription
canvasstringSource image. Same notation as crop.
detectLabelstringZoom into the bounding box of a detected object. Requires a prior detect_object run.
detectIndexnumberZero-based index when multiple detections share the same label. Default: 0.
frameAdjustnumber / stringExpand or shrink the detection box before rendering. Same semantics as in crop.
width / heightnumberOutput dimensions. Default: derived from the cropped region's aspect ratio.

Note: zoom-in uses image-to-image re-rendering. Results vary between models. Adding a prompt steers the AI toward reinterpretation rather than pure upscaling.

inpaint

Repaints the region inside a mask by re-generating that area with a new prompt. The area outside the mask is protected and remains unchanged.

Pass a prior mask result as canvas — the mask region is picked up automatically. Alternatively, use detectLabel to target a detected object without a separate mask step.

Parameters

ParameterTypeDescription
canvasstringSource image (or a prior mask result). Required.
promptstringWhat should appear in the repainted region. Default: empty (preserve existing content).
modelstringModel preset for re-rendering. Default: auto.
width / heightnumberOutput dimensions. Default: derived from canvas.
detectLabelstringTarget a detected object's bounding box directly. Requires a prior detect_object run.
detectIndexnumberZero-based index when multiple detections share the same label. Default: 0.
frameAdjustnumber / stringExpand or shrink the detection box. Same semantics as in crop.

outpaint

Extends the image beyond the mask boundary by regenerating the area outside the mask. The area inside the mask is protected and remains unchanged.

Pass a prior mask result as canvas — the mask region is picked up automatically. Alternatively, use detectLabel to target a detected object without a separate mask step.

Parameters

ParameterTypeDescription
canvasstringSource image (or a prior mask result). Required.
promptstringWhat should appear in the extended area. Default: empty (preserve existing content).
modelstringModel preset for re-rendering. Default: auto.
width / heightnumberOutput dimensions. Default: derived from canvas.
detectLabelstringTarget a detected object's bounding box directly. Requires a prior detect_object run.
detectIndexnumberZero-based index when multiple detections share the same label. Default: 0.
frameAdjustnumber / stringExpand or shrink the detection box. Same semantics as in crop.

Run in background

zoom-in, inpaint and outpaint accept runInBackground: true (default false). The call then returns immediately with a requestId while Draw Things renders; collect the result with request_progress. Useful for several independent edits (e.g. one inpaint per prompt): submit them in a row and retrieve each result afterwards.

request_progress

Checks, retrieves or cancels renders started with runInBackground: true.

ParameterTypeDescription
requestIdstringThe id returned by the tool. While rendering: progress and remaining time. When finished: the full result and image. Omit to list the status of all background requests (no images).
cancelbooleanWith requestId: removes a queued request or aborts a running one.

Note: In LM Studio, the plugin host is stopped shortly after the last tool call ends, which also cancels a still-running background render. Keep the chat busy (e.g. wait for the result) while a background render runs; the MCP server runs as a long-lived process and is not affected.

Standalone vs. draw-things-chat

This plugin works standalone — any LM Studio agent can call the tools directly. To enable the agent to "see", evaluate, and autonomously correct generated images, combine it with draw-things-chat. Vision Promotion — an exclusive feature of draw-things-chat — automatically routes generated images to the agent for review. Without it, generated images are displayed to the user but the agent itself cannot inspect them.

Setup

process-image communicates with Draw Things via its gRPC API. The crop and the mask tool work without a running Draw Things instance; zoom-in, inpaint and outpaint require it.

  • Draw Things gRPC server (required for zoom-in, inpaint and outpaint):

    • Draw Things > Advanced Settings: API Server: enable, ⚡️ gRPC Port: 7859, Transport Layer Security: enable, Response Compression: enable
  • Models (in the Draw Things app):

    • inpaint and outpaint use FLUX.2 [klein] 9B KV by default. Alternatives you can name in model: flux2 (FLUX.2 [dev], high-end), flux3_5b (FLUX.3 [klein]) or qwen_image_2.1 (Qwen Image 2.1 Turbo). Any model that can edit works.
    • zoom-in needs SeedVR2 7B (zoom pass) and, for small source images, FLUX.2 [klein] 9B KV (restore pass). Both are fixed; the tool checks for them before rendering and names what is missing.
    • The quantization does not matter: the 6-bit models are the defaults, but if you have another precision of the same model, it is used instead.
    • Want other models for these steps? Save presets in Draw Things (Save as...) named zoom.auto, restore.auto (zoom-in) or edit.auto (default for inpaint and outpaint), see draw-things-chat for how custom presets work.
  • Install the plugin:

  • Companion plugins (recommended):

    • draw-things-chat — full text2image / image2image / video generation, with Vision Promotion so the agent can "see" and evaluate its output
    • analyse-image — object detection (detect_object) that feeds bounding boxes directly into crop and zoom-in
    • playbook — write instructions, Agent Skills-compatible SKILL.md skill bundles, and notes in Markdown or plain text, let the agent find, read, write, and edit them
    • find-image — next-level image search and information retrieval based on multimodal embeddings
  • Useful Apps and Helpers

Changelog

See CHANGELOG.md for version history and release notes.

Configuration reference

SettingDefaultDescription
Previews in ChatonInline image previews in tool responses. Turn off when used with draw-things-chat — images are shown automatically. Turn on for standalone use.
Draw Things Host127.0.0.1Hostname or IP of the Draw Things backend server.
Draw Things HTTP Port7860HTTP API port.
Draw Things gRPC Port7859gRPC port.
Embed Metadata in PNGsonWrite generation parameters into saved PNGs as XMP metadata. Compatible with draw-things-index.
Custom Configs Path(Draw Things default path)Path to custom_configs.json from Draw Things. Set to none to disable.

License

MIT