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

A4.2/5.0
Behavior4/5

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

With no annotations, the description carries the full burden. It discloses clamping behavior for oversized targets, reports trim results via X-Pictomancer-Trim-* headers, and specifies the enhancement pipeline order (denoise -> equalize -> op -> sharpen). The response section is ambiguous about actual return payloads, but the disclosed behavior is substantive.

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 core prose is efficient, but the Responses section is bloated and repetitive: it lists three nearly identical 'Content-Type / Example Response: string' blocks that add little usable information. This templated noise lowers overall structure quality.

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

Completeness4/5

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

For a 14-parameter tool with no output schema and no annotations, the description covers the major decision axes: manual vs smart vs trim, enhancement modifiers, trimming headers, and response types. The response documentation is underwhelming but the core operational context is well covered.

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 the baseline is 3. The description adds value by explaining mutual exclusivity of modes, clarifying gravity's clamping, and noting threshold is only valid with trim. This goes beyond the schema's individual property descriptions.

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 opens with a specific verb and resource ('Crop an image') and immediately distinguishes three mutually exclusive modes (Manual, Smart crop, Trim). This clearly differentiates crop_image from siblings like resize_image or convert_image.

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 gives concrete guidance for choosing among the three modes: manual requires explicit coordinates, smart crop uses gravity, trim removes uniform borders. It does not explicitly name alternatives like resize_image, but the mode-selection context is clear enough for most use cases.

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

A4/5.0
Disambiguation4/5

Most tools have clearly distinct purposes (analyze, compress, convert, crop, resize, pipeline, optimize_for_vision, optimize_generated_image). However, there is some overlap between compress_image and convert_image (both deal with quality settings and can change format), and between resize_image and crop_image (resize's fill mode with smart-crop overlaps crop's smart crop). The pipeline tool could theoretically subsume any of the single-operation tools, which introduces a slight ambiguity in when to use pipeline vs. individual tools.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern (analyze_image, compress_image, convert_image, crop_image, get_format_info, image_pipeline, optimize_for_vision, optimize_generated_image, resize_image). The naming is predictable and self-documenting, with no mixing of camelCase or other conventions.

Tool Count5/5

With 9 tools, the server is well-scoped for an image processing domain. Each tool covers a core operation (analyze, compress, convert, crop, resize, pipeline, format info, and two optimization tools). The count feels appropriate—not too few to limit usefulness, not too many to be overwhelming.

Completeness5/5

The tool set provides comprehensive coverage for common image manipulation tasks: analysis, compression, format conversion, cropping, resizing, optimization for both general and AI-generated images, and a pipeline for chaining operations. Missing features like rotation, flipping, or color adjustments are minor but the core CRUD-like operations (read/analyze, write/convert, resize/crop) are well-represented, and the pipeline tool mitigates gaps by allowing combinations.

Resources