Skip to main content
Glama

Optimize Image

optimize_image

Compress and resize images, convert formats, and generate SEO metadata from local files or URLs to cut file size and improve search visibility.

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. Works as a guest with no signup. Log in with the login tool for more credits. 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_pathYesLocal server: absolute path where the optimized file was saved. Remote server: an https download URL that works without credentials until it expires (see download_expires_in_seconds); download it promptly.
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
download_expires_in_secondsNoRemote server only: seconds until the output_path download URL expires

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv2.1.3
    • addedOutput schema / properties / download_expires_in_seconds
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "number"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "description": "Remote server only: seconds until the output_path download URL expires"
      +}
    • changedOutput schema / properties / output_path / description
      Previous value: -"Absolute path where the optimized file was saved"New value: +"Local server: absolute path where the optimized file was saved. Remote server: an https download URL that works without credentials until it expires (see download_expires_in_seconds); download it promptly."
  2. 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"
      -]
  3. 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."
  4. First observedv2.0.1

TDQS

A4.5/5.0
Behavior5/5

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

Annotations only declare write/non-idempotent/open-world; the description adds substantial behavior: the automatic upscale trigger (target >1.2x source, charged even if unrequested), per-frame animated-GIF billing up to 601 credits, GIF exclusion from auto-upscaling, flat SVG/ICO credit override, the remote-mode URL-only restriction, and the 50 MB cap. This is exactly the beyond-annotation context the dimension rewards.

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?

Purpose is front-loaded and the format/limit facts are efficient, but the middle billing paragraph is a dense run-on ('A full pipeline is 7 credits... up to 601 credits at the 100-frame limit') that is hard to parse and partially duplicates cost notes already in the schema's parameter descriptions.

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 12-parameter mutation tool, the description covers modes, formats, size limits, cost model, GIF edge cases, and guest/auth behavior. An output schema exists, so return values need no explanation, and nothing an agent needs to invoke it correctly is missing.

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 earns above that by explaining cross-parameter cost interactions (width/height +1, upscale +2, SEO +1) and the resize-triggers-upscale rule that ties output_width_px/output_height_px to output_upscale_factor. It clarifies parameter economics rather than merely restating field names.

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?

States a specific verb+resource ('Optimize an image') and enumerates the concrete operations (smart lossy compression, resize/upscale/format conversion, AI SEO metadata). It is trivially distinguishable from the sibling tools (login/status/logout/upgrade), which handle account/credits rather than image work.

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?

Routes the agent to siblings: 'Log in with the login tool for more credits' and 'Use status tool to check remaining credits before batch processing,' plus the guest-mode note and the confirm_gif_cost gate. It gives clear usage context but no explicit when-not-to-use guidance (there is no competing image tool, so that omission is minor).

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