Design
Extract a specific rectangular region from an image by specifying area dimensions and position
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-extract-region' \
-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-extract-region' \
-F 'imageFile=/path/to/file.ext' \
-F 'extractMode=custom' \
-F 'width=0' \
-F 'height=0' \
-F 'gravity=center' \
-F 'x=0' \
-F 'y=0' \
-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-extract-region| Name | Type | Required | Description |
|---|---|---|---|
| imageFile | fileupload required | Yes | Upload any image file (JPEG, PNG, WebP, TIFF) for region extraction |
| extractMode | select | Yes | Choose how to extract region: custom dimensions, center, corner, or percentage |
| width | number | No | Set the extract width. For percentage mode, use 1-100 |
| height | number | No | Set the extract height. For percentage mode, use 1-100 |
| gravity |
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-extract-region": {
"name": "image-extract-region",
"description": "Extract a specific rectangular region from an image by specifying area dimensions and position",
"baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=image-extract-region",
"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-extract-region",
"arguments": {
"imageFile": "https://example.com/file.ext",
"extractMode": "custom",
"width": 0,
"height": 0,
"gravity": "center",
"x": 0,
"y": 0,
"format": "original",
"quality": 90
}
}
}| select |
| No |
| Choose where to position the extract area |
| x | number | No | Set the horizontal position for extract area (0 = left edge). Used in custom mode |
| y | number | No | Set the vertical position for extract area (0 = top edge). Used in custom mode |
| 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)"
}Questions or issues? Contact [email protected]