Design
Advanced image trimming with configurable tolerance levels for precise border removal
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-tolerance' \
-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-tolerance' \
-F 'imageFile=/path/to/file.ext' \
-F 'toleranceMode=absolute' \
-F 'toleranceValue=40' \
-F 'autoDetectBackground=true' \
-F 'backgroundColor=Manual background color (overrides auto-detect)' \
-F 'scanMethod=full' \
-F 'edgeSampling=true' \
-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-tolerance| Name | Type | Required | Description |
|---|---|---|---|
| imageFile | fileupload required | Yes | Upload any image file (JPEG, PNG, WebP, TIFF) for advanced tolerance trimming |
| toleranceMode | select | Yes | How to calculate color tolerance for background detection |
| toleranceValue | range | No | Tolerance for background detection. Higher = more pixels considered background |
| autoDetectBackground | checkbox | No | Analyze image edges to automatically determine the background color |
| backgroundColor | color | No | Specific background color to trim (disables auto-detection) |
| scanMethod | select | No | How to scan the image for content boundaries |
| edgeSampling | checkbox | No | Add padding proportional to tolerance to avoid cutting off edge content |
| analyzeOnly | checkbox | No | Analyze tolerance settings without trimming the image |
| 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-tolerance": {
"name": "image-trim-tolerance",
"description": "Advanced image trimming with configurable tolerance levels for precise border removal",
"baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=image-trim-tolerance",
"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-tolerance",
"arguments": {
"imageFile": "https://example.com/file.ext",
"toleranceMode": "absolute",
"toleranceValue": 40,
"autoDetectBackground": true,
"backgroundColor": "Manual background color (overrides auto-detect)",
"scanMethod": "full",
"edgeSampling": true,
"analyzeOnly": false,
"format": "original",
"quality": 90
}
}
}Questions or issues? Contact [email protected]