Skip to main content
Glama

crop_image

Crop an image

Extract a rectangular region from an image, in one of three mutually exclusive modes. Manual: give the top-left corner (x, y) and dimensions (width, height) in pixels. Smart crop: give 'gravity' (attention, entropy, centre) plus width and height; the window is picked automatically, clamped to the source if the target is larger. Trim: set 'trim: true' (optional 'threshold') to remove a uniform background border via content detection; the applied rect is reported in X-Pictomancer-Trim-* headers. Optional enhancement modifiers: denoise (1-3), equalize, sharpen (applied denoise -> equalize -> op -> sharpen).

Responses:

200: Processed image binary (Success Response) Content-Type: application/json Content-Type: image/jpeg

Example Response:

"string"

Content-Type: image/png

Example Response:

"string"

Content-Type: image/webp

Example Response:

"string"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xNoLeft edge of the crop rectangle in pixels. Manual mode only.
yNoTop edge of the crop rectangle in pixels. Manual mode only.
trimNoTrim mode: removes a uniform background border via content detection. Mutually exclusive with x/y/width/height/gravity.
widthNoWidth of the crop rectangle in pixels. Required in manual and gravity modes.
formatNoOutput format: jpeg, png, webp, tiff, gif, or avif. If omitted, the original format is preserved.
heightNoHeight of the crop rectangle in pixels. Required in manual and gravity modes.
sourceYesImage source: a public URL (https://...) or a base64-encoded string (optionally as a data URI like data:image/png;base64,...).
autorotNoApply EXIF orientation before cropping. Opt-in; default false, which preserves current byte-for-byte behavior.
denoiseNoMedian denoise before cropping: radius 1-3 (window 3x3 to 7x7). Opt-in; no surcharge.
gravityNoSmart-crop mode: picks the window automatically. One of ('attention', 'entropy', 'centre'). Requires width and height; mutually exclusive with x/y and trim. A target larger than the source clamps to the source size.
sharpenNoUnsharp-mask sharpen after cropping (libvips defaults). Opt-in.
deliveryNo
equalizeNoAuto-contrast (histogram equalisation of the value channel; hue and saturation preserved) before cropping. Opt-in.
thresholdNoTrim sensitivity (must be positive; default 10.0). Only valid together with trim: true.

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden. It discloses mutual exclusivity of modes, smart crop clamping, trim header reporting, and enhancement order. However, it omits major behavioral aspects like the delivery parameter (inline vs put_url vs callback) and autorot EXIF handling, which are important for agent usage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a summary followed by mode details and enhancements. However, the response examples are redundant and uninformative (repeated 'string' JSON), adding unnecessary length. Could be more concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (14 parameters, no output schema), the description covers modes and enhancements but fails to explain the delivery parameter, autorot behavior, or error responses. The response section is minimal and does not clarify the return format beyond 'binary' and Content-Type examples.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 93%, so baseline is 3. The description adds value by grouping parameters into modes, clarifying mutual exclusivity, and specifying enhancement application order. It also explains gravity options and trim threshold context beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Crop an image' and explains the three mutually exclusive modes (manual, smart crop, trim). It uses a specific verb-resource pair and distinguishes the tool from siblings like resize or compress by focusing on region extraction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use each mode (e.g., manual for explicit coordinates, smart crop for automatic window picking, trim for removing borders). However, it does not explicitly compare to sibling tools or state when not to use crop_image, leaving the selection largely implicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

TDQS

A3.9/5.0
Disambiguation3/5

Most tools are distinct, but compress_image, convert_image, and optimize_generated_image overlap heavily: all re-encode images with format and quality options. The descriptions clarify intent, yet an agent could still struggle to pick between compressing, converting, and optimizing in some cases.

Naming Consistency4/5

The set mostly follows a verb_noun pattern (analyze_image, compress_image, crop_image, resize_image). Minor deviations include image_pipeline, which is a noun phrase, and optimize_for_vision/optimize_generated_image, which use longer prepositional forms, but the overall pattern is predictable.

Tool Count5/5

Ten tools is well within the ideal range for an image-processing server. Each tool serves a meaningful purpose, and the count feels neither bloated nor thin.

Completeness4/5

Core image operations are well covered: analyze, resize, crop, convert, compress, pipeline, plus cost/format introspection. Minor gaps like rotate/flip or explicit metadata editing are absent, but agents can accomplish most workflows with the existing surface.

Resources