Skip to main content
Glama

Optimize Image

optimize_image

Compress, resize, upscale, convert formats, and create SEO metadata for images from local paths or URLs.

Instructions

Optimize an image: smart lossy compression (typically 60-80% size reduction), optional resize/upscale/format conversion, and AI-generated SEO metadata. Accepts absolute local file paths or remote URLs. In remote/API mode, only remote URLs are supported. Supported input formats: JPG, PNG, WebP, AVIF, GIF, SVG, ICO, HEIC, TIFF, BMP (max 50 MB). Supported output formats: JPG, PNG, WebP, AVIF, GIF, SVG, ICO. Credits: 3 to compress (always), +1 if width or height is set, +2 to upscale, +1 for SEO tags (on by default). A full pipeline is 7 credits. Upscale is charged whether you request it or the server adds it automatically — it does so whenever a resize target exceeds the source by more than 1.2x, so a resize-only call on a small image also costs 7. SVG or ICO output is a flat 1 credit, overriding everything above. Animated GIFs are billed per frame: (per-frame operations x frames) + 1 if tags, up to 601 credits at the 100-frame limit — confirm_gif_cost gates that path. GIFs are excluded from automatic upscaling. Guest (unregistered): 20 credits/day, no signup. Log in with the login tool for more credits — registered Free tier is 30/day. Use status tool to check remaining credits before batch processing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYesAbsolute local file path or remote URL of the image to optimize. Note: in remote/API mode, only remote URLs are supported (no local file paths). Supported inputs: JPG, PNG, WebP, AVIF, GIF (animated supported), HEIC, TIFF, BMP (max 50 MB). GlassyPic supports high-quality conversion between any input and output format.
output_pathNoWhere to save. Accepts a file path (/tmp/out.webp) or directory ending in / (/tmp/images/). If omitted: saves next to original, named with SEO slug when SEO is enabled or .polished suffix otherwise. URLs save to current working directory.
output_formatNoOutput format. Defaults to 'original' (keep input format). Animated GIFs stay animated when output is 'gif'; converting to other formats preserves only the first frame. SVG output from raster input uses vector tracing. ICO output generates a favicon set (16, 24, 32, 48, 256px) unless a specific size is given.
gif_frame_limitNoMaximum frames to process for animated GIFs (1-100, default 100). Reduces cost by sampling fewer frames while preserving animation.
output_width_pxNoTarget width in pixels. Set only width for proportional resize. Set both width and height for exact output dimensions (see output_resize_behavior). Costs 1 credit. If the target exceeds the source by more than 1.2x, the server also adds an AI upscale for a further 2 credits.
confirm_gif_costNoSet to true to proceed with animated GIF processing after seeing cost warning. Required for animated GIFs to prevent unexpected credit consumption.
output_height_pxNoTarget height in pixels. Set only height for proportional resize. Set both width and height for exact output dimensions (see output_resize_behavior). Costs 1 credit. If the target exceeds the source by more than 1.2x, the server also adds an AI upscale for a further 2 credits.
_gif_temp_file_idNoInternal: temp file ID from a previous GIF cost warning. Skips re-upload.
output_seo_tag_genNoGenerate SEO metadata (alt text, keywords, filename) and rename output file to SEO slug. Costs 1 extra credit. Default: true.
output_upscale_factorNoAI upscale factor: 2 (2×) or 4 (4×). Uses Real-ESRGAN for high-quality upscaling. Costs 2 credits. Note that upscaling also triggers automatically, without this parameter, whenever a resize target exceeds the source by more than 1.2x — the same 2 credits are charged either way.
output_file_size_limitNoTarget maximum output file size in bytes. The server will attempt to meet this limit through additional compression. Not guaranteed.
output_resize_behaviorNoWhen both width and height are set and aspect ratio differs: 'pad' adds white padding (default), 'crop' smart-crops to fill exact dimensions

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
output_pathYesAbsolute path where the optimized file was saved
seo_alt_textYesAI-generated image alt text for accessibility and SEO
seo_filenameYesAI-generated SEO filename slug without extension
seo_keywordsYesAI-generated keywords describing the image
output_formatYesOutput format: jpg, png, webp, avif, gif, svg, or ico
output_width_pxYesWidth of the output image in pixels
output_height_pxYesHeight of the output image in pixels
compression_ratioYesOutput-to-input size ratio, e.g. 0.35 means 65% smaller
output_size_bytesYesFile size of the optimized image in bytes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed14 schema fields changedv2.1.1
    • changedInput schema / properties / output_path / description
      Previous value: -"Where to save. Accepts a file path (/tmp/out.webp) or directory ending in / (/tmp/images/). If omitted: saves next to original, named with SEO slug when SEO is enabled or .tinified suffix otherwise. URLs save to current working directory."New value: +"Where to save. Accepts a file path (/tmp/out.webp) or directory ending in / (/tmp/images/). If omitted: saves next to original, named with SEO slug when SEO is enabled or .polished suffix otherwise. URLs save to current working directory."
    • addedOutput schema / properties / compression_ratio / anyOf
      Added value: +[
      +  {
      +    "type": "number"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedOutput schema / properties / compression_ratio / type
      Removed value: -[
      -  "number",
      -  "null"
      -]
    • addedOutput schema / properties / output_format / anyOf
      Added value: +[
      +  {
      +    "minLength": 0,
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedOutput schema / properties / output_format / description
      Previous value: -"Output format: jpg, png, webp, avif, or gif"New value: +"Output format: jpg, png, webp, avif, gif, svg, or ico"
    • removedOutput schema / properties / output_format / type
      Removed value: -[
      -  "string",
      -  "null"
      -]
    • addedOutput schema / properties / output_height_px / anyOf
      Added value: +[
      +  {
      +    "type": "number"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedOutput schema / properties / output_height_px / type
      Removed value: -[
      -  "number",
      -  "null"
      -]
    • addedOutput schema / properties / output_width_px / anyOf
      Added value: +[
      +  {
      +    "type": "number"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedOutput schema / properties / output_width_px / type
      Removed value: -[
      -  "number",
      -  "null"
      -]
    • addedOutput schema / properties / seo_alt_text / anyOf
      Added value: +[
      +  {
      +    "minLength": 0,
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedOutput schema / properties / seo_alt_text / type
      Removed value: -[
      -  "string",
      -  "null"
      -]
    • addedOutput schema / properties / seo_filename / anyOf
      Added value: +[
      +  {
      +    "minLength": 0,
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedOutput schema / properties / seo_filename / type
      Removed value: -[
      -  "string",
      -  "null"
      -]
  2. Changed3 schema fields changedv2.1.0
    • changedInput schema / properties / output_height_px / description
      Previous value: -"Target height in pixels. Set only height for proportional resize. Set both width and height for exact output dimensions (see output_resize_behavior)."New value: +"Target height in pixels. Set only height for proportional resize. Set both width and height for exact output dimensions (see output_resize_behavior). Costs 1 credit. If the target exceeds the source by more than 1.2x, the server also adds an AI upscale for a further 2 credits."
    • changedInput schema / properties / output_upscale_factor / description
      Previous value: -"AI upscale factor: 2 (2×) or 4 (4×). Uses Real-ESRGAN for high-quality upscaling."New value: +"AI upscale factor: 2 (2×) or 4 (4×). Uses Real-ESRGAN for high-quality upscaling. Costs 2 credits. Note that upscaling also triggers automatically, without this parameter, whenever a resize target exceeds the source by more than 1.2x — the same 2 credits are charged either way."
    • changedInput schema / properties / output_width_px / description
      Previous value: -"Target width in pixels. Set only width for proportional resize. Set both width and height for exact output dimensions (see output_resize_behavior)."New value: +"Target width in pixels. Set only width for proportional resize. Set both width and height for exact output dimensions (see output_resize_behavior). Costs 1 credit. If the target exceeds the source by more than 1.2x, the server also adds an AI upscale for a further 2 credits."
  3. First observedv2.0.1

TDQS

A4.6/5.0
Behavior5/5

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

The description goes far beyond the annotations: it discloses that compression is lossy, that upscaling can be triggered automatically even when not explicitly requested, that the server charges credits for this automatic behavior, and that SVG/ICO output has flat pricing that overrides the normal formula. It even describes GIF frame-based billing and the 100-frame cap. None of this contradicts the annotations; it substantially enriches them.

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 long, but almost every sentence carries operational or financial consequence. The most important information is front-loaded (what optimize does, input/output formats, credit costs). It is somewhat dense and could benefit from bullet separation, but it avoids fluff and redundancy aside from a minor repetition of the remote-URL mode caveat.

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

Completeness5/5

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

For a tool with 12 parameters, a complex credit model, format conversion rules, and GIF-specific behavior, the description covers the relevant context thoroughly: formats, size limits, file path semantics, automatic upscaling, credit calculation, quota limits, and where to check remaining credits. Since an output schema exists and the input schema details parameter defaults, nothing critical is left unexplained.

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 100%, so the baseline is 3. The description adds meaningful cross-parameter semantics not fully captured in the schema: the total credit formula, the automatic-upgrade cost condition, the SVG/ICO flat-rate override, GIF per-frame billing, and daily guest/free quotas. This helps an agent reason about combinations of parameters, not just individual ones.

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 scope — 'Optimize an image: smart lossy compression... optional resize/upscale/format conversion, and AI-generated SEO metadata' — and enumerates supported input/output formats. This clearly distinguishes optimize_image from siblings like status and upgrade, which serve entirely different purposes.

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 strong contextual guidance: it explains when remote URLs are required, warns that animated GIF processing needs confirm_gif_cost, tells users to check credits via the status tool before batch processing, and points to the login tool for higher quotas. It does not explicitly state 'when not to use this tool,' but no competing image-optimization sibling exists, so the absent exclusion is not a meaningful gap.

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

Deploy Server

Other Tools