Compress an image
image_compressReduce image file size by setting quality level or finding optimal quality to fit a target size. Reports the exact savings achieved.
Instructions
Reduce an image's file size, either by a quality level or by searching for the best quality that stays under a target size. Reports the exact saving achieved.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | http(s) URL to fetch. Disabled unless PICTOR_ALLOW_NET_FETCH=true. | |
| path | No | Path to the image, relative to an allowed input root (or absolute inside one). | |
| effort | No | Encoder effort; higher is slower and smaller. | |
| quality | No | Lossy quality 1-100 (higher is better quality and larger). | |
| lossless | No | Prefer lossless compression where supported. | |
| base64_data | No | Inline image bytes as base64, optionally a data: URI. | |
| output_name | No | Override the output filename (a safe name is derived if omitted). | |
| return_image | No | Embed the resulting image inline so vision-capable clients can see it. | |
| return_base64 | No | Include the base64 payload in the JSON result for clients without file access. | |
| target_format | No | Output codec: jpeg, png, webp, avif, tiff, gif, bmp, ico, jpeg2000, qoi, ppm. Defaults to the input format. | |
| strip_metadata | No | Remove EXIF/GPS/ICC metadata. Defaults to the server setting (on). | |
| target_size_kb | No | Target maximum file size in kilobytes; quality is searched to fit. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | No | ||
| input | No | Summary of the source image, when one was read. | |
| notes | No | ||
| steps | No | ||
| metrics | No | Operation-specific measurements (e.g. comparison scores). | |
| outputs | No | ||
| operation | Yes | Tool that produced this result. | |
| sizeChange | No | ||
| inlineImageIncluded | No | True when an image block accompanies this result for vision-capable clients. |