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 |
|---|---|---|---|
| crop | No | Crop image. Use width+height for pixel-exact, or aspectRatio for ratio-based. Strategy controls where to crop from. | |
| trim | No | Auto-trim whitespace borders | |
| format | No | Convert to format. Defaults to original format. | |
| resize | No | Resize image. Maintains aspect ratio if only width or height given. | |
| quality | No | Output quality for JPEG/WebP (1-100). Default 90. | |
| filename | No | Base name for saved file. Auto-versioned if duplicate. | |
| imagePath | Yes | Path to the image file to process | |
| outputDir | No | Directory to save. Defaults to config file outputDir, OUTPUT_DIR env var, or ~/gemini-images | |
| subfolder | No | Subfolder within output directory | |
| removeBackground | No | Remove background. mode 'auto' (AI matte, any subject), 'chroma' (green screen), or 'threshold' (white). Defaults: chroma if color set, else threshold. |