Change the background color of an image

The tool automatically detects the dominant color at the edges of your image (the presumed background), then replaces all pixels of a similar color with the new color of your choice — without removing transparency.

Example:
Drag and drop an image here, or click to browse (max 25 MB).

How it works

The tool samples a thin ring of pixels along all four edges of the image and calculates their average color: this is the presumed background color. It then replaces, across the whole image, every pixel close enough to that color with the chosen new color, while keeping existing transparency and the subject's pixels intact.

What if automatic detection gets it wrong?

If the subject touches the edges of the image (for example, a tightly cropped photo), the detected color may correspond to the subject rather than the background. Crop the image to leave a visible background margin along the edges, or use the magic wand tool instead, which lets you click precisely on the color to target.

Does this tool work on a gradient background?

No, it is designed for solid-color backgrounds. On a gradient, the edge average only represents part of the background shades, and the replacement will likely leave some gradient areas unchanged.

100% local processing: background detection and color replacement are performed entirely in your browser — your image is never sent to a server.