Raw definition
{
"name": "optimize_image_urls",
"title": "Optimize images",
"description": "Compress and optimize images from public URLs. Reduces file size, converts to WebP or AVIF, resizes or smart-crops, upscales, keeps or strips EXIF metadata, and removes backgrounds. Returns the optimized image URL and the percentage saved for each input.\n\nUse this when the user wants to: make images smaller or load faster, compress JPEG, PNG, GIF, WebP or AVIF files, convert images to WebP or AVIF, resize or crop images to given dimensions, remove an image background, reduce image size without visible quality loss, or improve page speed and Core Web Vitals by optimizing the images of a web page.\n\nRequires publicly reachable http(s) image URLs. It cannot read local files, uploaded attachments, or images behind a login.",
"inputSchema": {
"type": "object",
"$schema": "http://json-schema.org/draft-07/schema#",
"required": [
"urls"
],
"properties": {
"urls": {
"type": "array",
"items": {
"type": "string",
"format": "uri"
},
"maxItems": 100,
"minItems": 1,
"description": "Public image URLs to optimize, 1 to 100 entries. Each must be reachable over http(s) without authentication"
},
"wait": {
"type": "integer",
"default": 20,
"maximum": 30,
"minimum": 0,
"description": "Maximum seconds to wait per API call: 0=return immediately, 1-30=wait for processing"
},
"lossy": {
"type": "integer",
"default": 1,
"maximum": 2,
"minimum": 0,
"description": "Compression level: 0=lossless (no quality loss, larger files), 1=lossy (smallest files), 2=glossy (near-lossless, best for photography)"
},
"resize": {
"enum": [
0,
1,
3,
4
],
"type": "number",
"default": 0,
"description": "Resize mode: 0=none, 1=outer (cover), 3=inner (fit inside), 4=smart crop"
},
"refresh": {
"enum": [
0,
1
],
"type": "number",
"default": 0,
"description": "Re-fetch source before optimization: 1=yes, 0=use cached if available"
},
"upscale": {
"enum": [
0,
2,
3,
4
],
"type": "number",
"default": 0,
"description": "Upscale factor to enlarge the image: 0=off, 2=2x, 3=3x, 4=4x"
},
"cmyk2rgb": {
"enum": [
0,
1
],
"type": "number",
"default": 1,
"description": "Convert CMYK images to RGB for correct web display: 1=yes, 0=no"
},
"bg_remove": {
"anyOf": [
{
"type": "number",
"const": 1
},
{
"type": "string",
"format": "uri"
},
{
"type": "string",
"pattern": "^#[0-9a-fA-F]{8}$"
}
],
"description": "Remove the image background: 1=make it transparent, an image URL=replace it with that image, #rrggbbxx=fill with a color plus alpha"
},
"convertto": {
"type": "string",
"minLength": 1,
"description": "Convert to another format, e.g. +webp, +avif, +webp|+avif, webp|avif, jpg, png, gif. Empty means no conversion"
},
"keep_exif": {
"enum": [
0,
1
],
"type": "number",
"default": 0,
"description": "Preserve EXIF metadata such as camera and GPS data: 1=keep, 0=remove for smaller files"
},
"paramlist": {
"type": "array",
"items": {
"type": "object",
"properties": {
"wait": {
"type": "integer",
"maximum": 30,
"minimum": 0,
"description": "Per-URL wait time in seconds: 0=return immediately, 1-30=wait for processing"
},
"lossy": {
"type": "integer",
"maximum": 2,
"minimum": 0,
"description": "Per-URL compression level override: 0=lossless, 1=lossy, 2=glossy"
},
"resize": {
"enum": [
0,
1,
3,
4
],
"type": "number",
"description": "Per-URL resize mode override: 0=none, 1=outer, 3=inner, 4=smart crop"
},
"refresh": {
"enum": [
0,
1
],
"type": "number",
"description": "Per-URL source refresh override: 1=force re-download, 0=allow cached optimized result"
},
"upscale": {
"enum": [
0,
2,
3,
4
],
"type": "number",
"description": "Per-URL upscale factor override: 0=off, 2=2x, 3=3x, 4=4x"
},
"cmyk2rgb": {
"enum": [
0,
1
],
"type": "number",
"description": "Per-URL CMYK to RGB conversion override: 1=yes, 0=no"
},
"bg_remove": {
"anyOf": [
{
"type": "number",
"const": 1
},
{
"type": "string",
"format": "uri"
},
{
"type": "string",
"pattern": "^#[0-9a-fA-F]{8}$"
}
],
"description": "Per-URL background removal override: 1=transparent, URL=background image, #rrggbbxx=color+alpha"
},
"convertto": {
"type": "string",
"minLength": 1,
"description": "Per-URL format conversion override, e.g. +webp, +avif, +webp|+avif, webp|avif, jpg, png, gif"
},
"keep_exif": {
"enum": [
0,
1
],
"type": "number",
"description": "Per-URL EXIF handling override: 1=keep metadata, 0=remove metadata"
},
"resize_width": {
"type": "integer",
"description": "Per-URL target width in pixels, used with resize > 0",
"exclusiveMinimum": 0
},
"resize_height": {
"type": "integer",
"description": "Per-URL target height in pixels, used with resize > 0",
"exclusiveMinimum": 0
}
},
"additionalProperties": false
},
"maxItems": 100,
"description": "Per-URL parameter overrides by index; if provided, must have same length as urls"
},
"resize_width": {
"type": "integer",
"description": "Target width in pixels, used with resize > 0",
"exclusiveMinimum": 0
},
"resize_height": {
"type": "integer",
"description": "Target height in pixels, used with resize > 0",
"exclusiveMinimum": 0
},
"returndatalist": {
"type": "array",
"items": {},
"description": "Any array echoed back unchanged in API response for caller correlation"
}
},
"additionalProperties": false
},
"annotations": {
"title": "Optimize images",
"readOnlyHint": false,
"openWorldHint": true,
"idempotentHint": false,
"destructiveHint": false
}
}