Skip to main content
Glama

Optimize Image

optimize_image

Optimize images with smart compression, resize, upscale, format conversion, and AI SEO metadata generation. Accepts local files 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. Each call costs 3 credits + 1 if SEO tags enabled. Animated GIFs are processed frame-by-frame (each frame optimized individually). Cost = frames × per-frame operations. Use confirm_gif_cost: true after reviewing the cost warning. Free tier: 20 credits/day, 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 .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).
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).
_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.
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?

No annotations provided, so description carries full burden. Discloses credit costs, animated GIF frame-by-frame processing, cost calculation, format constraints, local vs remote behavior, and default output paths. Comprehensive.

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?

Single paragraph with clear front-loading of main purpose. Some redundancy with schema descriptions, but overall efficient and well-structured.

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?

Given the tool's complexity (12 parameters, multiple behaviors), the description covers costs, limits, special cases (animated GIFs, local vs remote), and essential behavioral details. Output schema exists, so return values are not needed.

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 coverage is 100%, so parameters are fully described. The description adds general context but does not substantially elaborate beyond schema for individual parameters.

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?

Description clearly states the tool's purpose: optimize images with compression, resize/upscale/format conversion, and SEO metadata. Uses specific verb+resource and distinguishes from sibling tools like login/status.

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?

Provides guidance on credit costs, free tier limits, use of confirm_gif_cost for animated GIFs, and suggests checking status tool. Does not explicitly exclude use cases or direct to alternatives.

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