Categories

Image Trim by Color

Remove specific colored borders and backgrounds from images by trimming pixels matching selected colors

Click to upload file or drag and drop file here

Maximum file size: 10MB Supported formats: image/jpeg, image/png, image/webp, image/tiff

Upload any image file (JPEG, PNG, WebP, TIFF) for color-based trimming

Choose a common color to trim

Custom color to trim from image borders

Sample the color to trim from a specific position in the image

Where to sample the color from the image

0 30 50

Tolerance for color matching (0-50). Higher = more colors will match

Analyze the image to find color boundaries without creating a trimmed file

Choose output format or keep original

Output quality for lossy formats (JPEG, WebP). Higher = better quality but larger file size

Key Facts

Category
Design
Input Types
file, select, color, checkbox, range, number
Output Type
file
Sample Coverage
4
API Ready
Yes

Overview

Image Trim by Color is a precise utility designed to automatically remove unwanted borders or backgrounds from your images by identifying and cropping pixels that match a specific color.

When to Use

  • Removing solid-colored borders from scanned documents or screenshots.
  • Cleaning up images with uniform backgrounds for professional presentation.
  • Standardizing image dimensions by trimming excess padding of a specific hue.

How It Works

  • Upload your image file in JPEG, PNG, WebP, or TIFF format.
  • Select a preset color, pick a custom color, or sample a color directly from a specific position in the image.
  • Adjust the color tolerance slider to define how strictly the tool should match the target color.
  • Process the image to automatically trim the matching pixels and download your cleaned file.

Use Cases

Removing white margins from digital art or scanned sketches.
Cropping out solid black backgrounds from product photography.
Standardizing screenshot dimensions by removing uniform desktop background colors.

Examples

1. Clean Scanned Document Borders

Office Administrator
Background
A collection of scanned receipts contains inconsistent white borders that need to be removed for a clean report.
Problem
Manual cropping is tedious and inconsistent across dozens of files.
How to Use
Upload the receipt image, select 'White' from preset colors, and set tolerance to 20.
Example Config
presetColors: 'white', colorTolerance: 20
Outcome
The tool automatically detects and removes the white margins, leaving only the receipt content.

2. Remove Background from Product Image

E-commerce Seller
Background
Product photos were taken against a solid blue backdrop that needs to be removed.
Problem
The background color is uniform but needs precise trimming to avoid cutting into the product.
How to Use
Upload the product photo, sample the color from the 'Top Left Corner', and adjust tolerance to 10.
Example Config
sampleFrom: true, samplePosition: 'top-left', colorTolerance: 10
Outcome
The blue background is trimmed away, creating a tightly cropped image of the product.

Try with Samples

image, png, jpg

Related Hubs

FAQ

Which image formats are supported?

You can upload and process JPEG, PNG, WebP, and TIFF image files.

What does the color tolerance setting do?

The tolerance (0-50) determines how closely a pixel must match your selected color to be trimmed. Higher values include a wider range of similar shades.

Can I sample a color directly from the image?

Yes, enable the 'Sample Color from Image' option and choose a position like 'Top Left Corner' or 'Center' to automatically detect the color to be trimmed.

What is the 'Analyze Only' mode?

This mode allows you to detect color boundaries without generating a new file, which is useful for testing your tolerance settings.

Can I change the file format after trimming?

Yes, you can select a different output format such as JPEG, PNG, or WebP, or choose to keep the original format.

API Documentation

Request Endpoint

POST /en/api/tools/image-trim-color

Request Parameters

Parameter Name Type Required Description
imageFile file (Upload 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 type parameters need to be uploaded first via POST /upload/image-trim-color to get filePath, then pass filePath to the corresponding file field.

Response Format

{
  "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)"
}
File: File

AI MCP Documentation

Add this tool to your MCP server 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://elysiatools.com/mcp/sse?toolId=image-trim-color",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

You can chain multiple tools, e.g.: `https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`, max 20 tools.

Supports URL file links or Base64 encoding for file parameters.

If you encounter any issues, please contact us at [email protected]