Project Files
README.md
An LM Studio plugin that gives your agent precise image-editing tools: cropping, masking, AI-powered zoom-in, inpainting, and outpainting — all via Draw Things.
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
| Parameter | Type | Description |
|---|---|---|
canvas | string | Source image. Notation: a1, v2, p1, i3. Shorthand: a → a1, i → i1. |
cropLeft | number / string | Amount to remove from the left. Default unit: % (0–99). Append px for absolute pixels. Default: 0. |
cropRight | number / string | Amount to remove from the right. Same units. Default: 0. |
cropTop | number / string | Amount to remove from the top. Same units. Default: 0. |
cropBottom | number / string | Amount to remove from the bottom. Same units. Default: 0. |
imageFormat | string | Enforce a target aspect ratio: square (1:1), landscape (4:3), (3:4), . Ignored when all four sides are explicitly given. |
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.
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
| Parameter | Type | Description |
|---|---|---|
canvas | string | Source image. Same notation as crop. |
cropLeft | number / string | Amount to remove from the left when defining the mask region. Same units as crop. |
cropRight | number / string | Amount to remove from the right. Same units. |
cropTop | number / string | Amount to remove from the top. Same units. |
cropBottom | number / string | Amount to remove from the bottom. Same units. |
imageFormat | string | Target aspect ratio for the mask region. Same values as crop. |
detectLabel | string | Place the mask on a detected object's bounding box. Requires a prior detect_object run. |
detectIndex | number | Zero-based index when multiple detections share the same label. Default: 0. |
frameAdjust | number / string | Expand or shrink the detection box before masking. Same semantics as crop. |
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
| Parameter | Type | Description |
|---|---|---|
canvas | string | Source image. Same notation as crop. |
detectLabel | string | Zoom into the bounding box of a detected object. Requires a prior detect_object run. |
detectIndex | number | Zero-based index when multiple detections share the same label. Default: 0. |
frameAdjust | number / string | Expand or shrink the detection box before rendering. Same semantics as in crop. |
width / height | number | Output 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.
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
| Parameter | Type | Description |
|---|---|---|
canvas | string | Source image (or a prior mask result). Required. |
prompt | string | What should appear in the repainted region. Default: empty (preserve existing content). |
model | string | Model preset for re-rendering. Default: auto. |
width / height | number | Output dimensions. Default: derived from canvas. |
detectLabel | string | Target a detected object's bounding box directly. Requires a prior detect_object run. |
detectIndex | number | Zero-based index when multiple detections share the same label. Default: 0. |
frameAdjust | number / string | Expand or shrink the detection box. Same semantics as in crop. |
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
| Parameter | Type | Description |
|---|---|---|
canvas | string | Source image (or a prior mask result). Required. |
prompt | string | What should appear in the extended area. Default: empty (preserve existing content). |
model | string | Model preset for re-rendering. Default: auto. |
width / height | number | Output dimensions. Default: derived from canvas. |
detectLabel | string | Target a detected object's bounding box directly. Requires a prior detect_object run. |
detectIndex | number | Zero-based index when multiple detections share the same label. Default: 0. |
frameAdjust | number / string | Expand or shrink the detection box. Same semantics as in crop. |
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 ofdraw-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.
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.
See CHANGELOG.md for version history and release notes.
| Setting | Default | Description |
|---|---|---|
| Previews in Chat | on | Inline image previews in tool responses. Turn off when used with draw-things-chat — images are shown automatically. Turn on for standalone use. |
| Draw Things Host | 127.0.0.1 | Hostname or IP of the Draw Things backend server. |
| Draw Things HTTP Port | 7860 | HTTP API port. |
| Draw Things gRPC Port | 7859 | gRPC port. |
| Embed Metadata in PNGs | on | Write 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. |
MIT
portrait16:9detectLabel | string | Crop to the bounding box of a detected object by label. Requires a prior detect_object run. |
detectIndex | number | Zero-based index to select among multiple detections with the same label. Default: 0. |
frameAdjust | number / string | Expand (positive) or shrink (negative) the detection bounding box before cropping. Number: % of min(W,H). String with px suffix: absolute pixels. |
Draw Things gRPC server (required for zoom-in, inpaint and outpaint):
API Server: enable, ⚡️ gRPC Port: 7859, Transport Layer Security: enable, Response Compression: enableInstall the plugin:
Companion plugins (recommended):
detect_object) that feeds bounding boxes directly into crop and zoom-in