Process Image
process_imageCrop, resize, remove background, convert format, or trim whitespace locally. No API calls.
Instructions
Process an existing image locally using sharp. Crop, resize, remove background, convert format, or trim whitespace. Free, fast, no API calls. For AI-powered editing (style changes, complex background removal), use generate_image with the image as input instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| imagePath | Yes | Path to the image file to process | |
| crop | No | Crop image. Use width+height for pixel-exact, or aspectRatio for ratio-based. Strategy controls where to crop from. | |
| resize | No | Resize image. Maintains aspect ratio if only width or height given. | |
| removeBackground | No | Remove background. mode 'auto' (AI matte, any subject), 'chroma' (green screen), or 'threshold' (white). Defaults: chroma if color set, else threshold. | |
| trim | No | Auto-trim whitespace borders | |
| format | No | Convert to format. Defaults to original format. | |
| quality | No | Output quality for JPEG/WebP (1-100). Default 90. | |
| outputDir | No | Directory to save. Defaults to config file outputDir, OUTPUT_DIR env var, or ~/gemini-images | |
| filename | No | Base name for saved file. Auto-versioned if duplicate. | |
| subfolder | No | Subfolder within output directory |