# Image Trim by Color

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

> Canonical page: https://elysiatools.com/en/tools/image-trim-color

- **Category:** Design

- **Keywords:** image, trim, color, border, background, remove, specific, hue

## 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.

## Inputs

- **Image File** (file): Upload any image file (JPEG, PNG, WebP, TIFF) for color-based trimming
- **Preset Colors** (select): Choose a common color to trim
- **Custom Color** (color): Custom color to trim from image borders
- **Sample Color from Image** (checkbox): Sample the color to trim from a specific position in the image
- **Sample Position** (select): Where to sample the color from the image
- **Color Tolerance** (range): Tolerance for color matching (0-50). Higher = more colors will match
- **Analyze Only** (checkbox): Analyze the image to find color boundaries without creating a trimmed file
- **Output Format** (select): Choose output format or keep original
- **Quality (1-100)** (number): Output quality for lossy formats (JPEG, WebP). Higher = better quality but larger file size

## 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.

## Frequently asked questions

### 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.

## Related tools

- [Image Morphological Opening](https://elysiatools.com/en/tools/image-open): Apply morphological opening operation (erosion followed by dilation) to remove small noise and separate connected objects
- [Image Trim Whitespace](https://elysiatools.com/en/tools/image-trim-whitespace): Remove whitespace and empty margins from images by detecting and trimming blank areas
- [Remove Image Background](https://elysiatools.com/en/tools/image-background-remover): Remove image backgrounds and export a transparent PNG
- [Median Pass Filter](https://elysiatools.com/en/tools/image-median-pass): Apply median pass filter to remove noise while preserving edges with multiple algorithms
- [Parallax Animation Generator](https://elysiatools.com/en/tools/image-parallax): Generate parallax animations from images. Creates depth-based animation where different layers move at different speeds, creating a 3D effect.
- [Image Trim](https://elysiatools.com/en/tools/image-trim): Trim image borders by removing unwanted edges and margins automatically
- [Image Trim with Tolerance](https://elysiatools.com/en/tools/image-trim-tolerance): Advanced image trimming with configurable tolerance levels for precise border removal
- [Image Translation](https://elysiatools.com/en/tools/image-translation): Apply translation transformation to move images horizontally and vertically. Visualize the translation matrix and see how pixel coordinates shift.

## Samples

- [Web Image Processing Python Samples](https://elysiatools.com/en/samples/web-image-processing-python): Web Python image processing examples using PIL/Pillow including reading, saving, resizing, and format conversion
- [Android Image Processing Java Samples](https://elysiatools.com/en/samples/android-image-processing-java): Android Java image processing examples including reading/saving images, scaling, and format conversion
- [Android Image Processing Kotlin Samples](https://elysiatools.com/en/samples/android-image-processing-kotlin): Android Kotlin image processing examples including reading/saving images, scaling, and format conversion
- [Web Image Processing Rust Samples](https://elysiatools.com/en/samples/web-image-processing-rust): Web Rust image processing examples including image read/save, scaling, and format conversion

## Related content

- [Image Cleanup, Resizing, and Detail Enhancement](https://elysiatools.com/en/hubs/image-cleanup-resize-and-detail-enhancement): Prepare reviewed images for delivery by fixing orientation, trimming edges, reducing noise, resizing precisely, and restoring crisp detail.
