Design
Remove specific colored borders and backgrounds from images by trimming pixels matching selected colors
Call this tool from your code in three languages.
# 1) Upload each file first → returns { filePath }
curl -X POST 'https://api.elysiatools.com/upload/image-trim-color' \
-F 'file=@/path/to/imageFile.ext'
# 2) Call the tool with the returned filePath values
curl -X POST 'https://api.elysiatools.com/en/api/tools/image-trim-color' \
-F 'imageFile=/path/to/file.ext' \
-F 'presetColors=white' \
-F 'trimColor=Select color to trim...' \
-F 'sampleFrom=false' \
-F 'samplePosition=top-left' \
-F 'colorTolerance=30' \
-F 'analyzeOnly=false' \
-F 'format=original' \
-F 'quality=90'Send a POST request with your inputs as JSON. File parameters require a separate upload first.
POST https://api.elysiatools.com/en/api/tools/image-trim-color| Name | Type | Required | Description |
|---|---|---|---|
| imageFile | fileupload required | Yes | Upload any image file (JPEG, PNG, WebP, TIFF) for color-based trimming |
| presetColors | select | No | Choose a common color to trim |
| trimColor | color | No | Custom color to trim from image borders |
| sampleFrom | checkbox | No | Sample the color to trim from a specific position in the image |
| samplePosition | select | No | Where to sample the color from the image |
| colorTolerance | range | No | Tolerance for color matching (0-50). Higher = more colors will match |
| analyzeOnly | checkbox | No | Analyze the image to find color boundaries without creating a trimmed file |
| format | select | No | Choose output format or keep original |
| quality | number | No | Output quality for lossy formats (JPEG, WebP). Higher = better quality but larger file size |
File result
{
"filePath": "/public/processing/randomid.ext",
"fileName": "output.ext",
"contentType": "application/octet-stream",
"size": 1024,
"metadata": {
"key": "value"
},
"error": "Error message (optional)",
"message": "Notification message (optional)"
}Add this tool to your Model Context Protocol server so AI agents can list and call it.
Add this block to your MCP client configuration:
{
"mcpServers": {
"elysiatools-image-trim-color": {
"name": "image-trim-color",
"description": "Remove specific colored borders and backgrounds from images by trimming pixels matching selected colors",
"baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=image-trim-color",
"command": "",
"args": [],
"env": {},
"isActive": true,
"type": "sse"
}
}
}After connecting to the SSE endpoint, list the exposed tools:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}Invoke the tool by its id, passing arguments built from its parameters:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "image-trim-color",
"arguments": {
"imageFile": "https://example.com/file.ext",
"presetColors": "white",
"trimColor": "Select color to trim...",
"sampleFrom": false,
"samplePosition": "top-left",
"colorTolerance": 30,
"analyzeOnly": false,
"format": "original",
"quality": 90
}
}
}Questions or issues? Contact [email protected]