Skip to main content
Glama

Optimize Image

optimize_image

Reduce image file size with smart lossy compression, resize or upscale, convert format, and generate AI SEO metadata. Works for local paths and remote 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 .tinified 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, or gif
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
Behavior5/5

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

Discloses non-obvious behavior beyond annotations: automatic upscaling trigger (over 1.2x), per-frame GIF billing with 601 credit cap, flat 1-credit override for SVG/ICO, and default SEO tagging (on by default). No contradiction with readOnlyHint=false.

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

Conciseness5/5

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

The description is dense but each sentence provides actionable details, from supported formats to credit calculations. It starts with the core action and progressively layers constraints, making it easy to scan.

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?

Covers input/output formats, size limits, cost model, remote mode, authentication implications, and prerequisite checks. With 12 parameters and complex billing logic, the description leaves no critical gaps for an agent to make a costly error.

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

Parameters5/5

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

Despite 100% schema coverage, the description enriches parameters with credit costs, conditional defaults, and special cases (e.g., output_format behaviors, auto-upscale when width/height set, confirm_gif_cost gating). This goes beyond the schema's 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+resource: 'Optimize an image', then enumerates concrete capabilities (lossy compression, resize/upscale/format conversion, AI SEO metadata). This clearly distinguishes it from sibling tools like login, status, and upgrade.

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

Usage Guidelines5/5

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

Provides explicit context: remote/API mode restrictions, guest vs registered credit limits, and direction to 'Use status tool to check remaining credits before batch processing'. Also explains when confirm_gif_cost is required and how to log in for more credits.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/onepunchtechnology/glassypic-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server