Optimize local image
optimize_imageCompress, resize, and convert local images without uploads or API keys. Reduce file size before committing or attaching images, with optional format, quality, and dimension controls.
Instructions
Compress, resize and convert a LOCAL image file on this machine — no API key, nothing is uploaded. Use before committing or attaching an image, or when asked to make an image smaller. path is the file; optional format (keep|webp|avif|jpg|png, default keep), max_width/max_height (never upscales), quality (1-100, default 80), keep_metadata (EXIF/GPS is stripped by default), output_path or in_place, and dry_run to preview. Writes .optimized. next to the original by default and never makes a file bigger (an already-optimal file is left alone). Supports JPG/PNG/WebP/AVIF; for an image already hosted on PixelVault use transform_image (fmt/q/w) instead.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"path": "<path>"
},
"name": "optimize_image"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | LOCAL file path of the image to optimize (JPEG, PNG, WebP or AVIF). Absolute, or relative to the server's working directory. | |
| format | No | Output format. Default keep. WebP is usually the smallest for web use. | |
| dry_run | No | Report the saving without writing anything. | |
| quality | No | JPEG/WebP/AVIF quality 1-100 (default 80). PNG output is always lossless. | |
| in_place | No | Overwrite the original instead of writing a new file (only with format keep). Use only for files under version control. | |
| max_width | No | Downscale to at most this width in px. Never upscales. | |
| max_height | No | Downscale to at most this height in px. Never upscales. | |
| output_path | No | Where to write the result. Default: <name>.optimized.<ext> next to the original. Must not already exist unless it is a *.optimized.* file. | |
| keep_metadata | No | Keep EXIF/GPS metadata. Default false: it is stripped (orientation is applied first). |