Skip to main content
Glama

compress_image

Compress an image

Re-encode an image with quality/format options to reduce file size. Supports jpeg, png, webp, tiff, gif. Instead of a q number you can set quality_target (0-1]: the smallest file with SSIM at or above the target, searched on the worker (jpeg, webp, avif; flat surcharge; outcome reported in X-Pictomancer-Quality-* headers). If the output is not smaller than the input, the request is free (X-Pig-Billed: 0) and does not consume free-tier quota. 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
qNoQuality (1-100). Lower = smaller file. Typical values: 60-80 for web, 85-95 for print. Maps to libvips Q parameter.
stripNoStrip metadata (EXIF, ICC profile, etc.) from the output. Reduces file size slightly.
formatNoOutput format: jpeg, png, webp, tiff, gif, or avif. If omitted, the original format is preserved.
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 compressing. Opt-in; default false, which preserves current byte-for-byte behavior.
denoiseNoMedian denoise before compressing: radius 1-3 (window 3x3 to 7x7). Opt-in; no surcharge.
sharpenNoUnsharp-mask sharpen after compressing (libvips defaults). Opt-in.
deliveryNo
equalizeNoAuto-contrast (histogram equalisation of the value channel; hue and saturation preserved) before compressing. Opt-in.
quality_targetNoTarget SSIM (0-1]: the worker searches for the smallest file that still scores at least this. Alternative to q; mutually exclusive with it. Requires an explicit format among jpeg, webp, avif. Carries a flat surcharge for the extra encodes.

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations provided, the description bears the full burden of behavioral disclosure. It clearly states the tool is a mutation (write) operation, describes the free-tier quota behavior (X-Pig-Billed: 0 if output not smaller), mentions the surcharge for quality_target searches, and notes the enhancement processing order. However, it does not disclose whether the input source is stored, how long results are available, or rate limits. Given the complexity, it covers the most critical behavioral traits well.

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

Conciseness4/5

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

The description is a single block of text with clear sections: purpose, format support, quality modes, free-tier rule, enhancement order. It uses clear sentences without redundancy. However, it could be more structured (e.g., bullet points for formats or modifiers). Length is justified by the tool's complexity (10 params, 3 delivery modes). No wasted words.

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 complex image processing tool with 10 parameters, multiple output formats, and delivery modes, the description provides substantial context beyond the schema. It explains the quality_target workflow, enhancement ordering, free-tier behavior, and format support. No output schema exists, but the description notes responses are binary images with Content-Type headers. Missing: explicit details on delivery mode semantics (inline vs PUT vs callback) — these are in the schema but the description doesn't summarize trade-offs. Overall, strong coverage for the complexity.

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

Parameters3/5

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

Schema description coverage is high (90%), so the baseline is 3. The description adds context by listing supported formats and explaining the quality_target workflow (SSIM target, formats supported, surcharge). It also mentions the enhancement order and free-tier behavior. However, much of the param info (q range, strip meaning, format list) is already in the schema. The description does not add value for all params (e.g., source, delivery remain schema-only). It compensates enough to stay at baseline.

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 starts with a powerful verb ('Compress') and noun ('image'), immediately followed by the mechanism ('Re-encode...to reduce file size'). It lists supported formats and distinguishes the two quality modes (q vs quality_target). The siblings include convert_image, resize_image, crop_image — this description clearly separates compression from those transformations.

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 explains when to use q vs quality_target (mutually exclusive, latter for SSIM-guided size reduction) and mentions optional enhancement modifiers (denoise, equalize, sharpen) and their processing order. It also notes that free-tier quota is not consumed if the output isn't smaller. However, it doesn't explicitly say when to prefer this over convert_image or optimize_for_vision, nor does it state when not to use it (e.g., for lossless color space conversion).

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