gizmobench

Image Color Replacer

Pick the color you want to change straight from your picture, choose the new one, and every visible pixel within the tolerance is replaced, fading out across a feather so edges stay soft. With Keep shading on, each pixel keeps its brightness relative to the color you picked, measured as luminance in linear light, so a red mug in shadow becomes a blue mug in the same shadow instead of a flat blue cutout. A rule can make its matches transparent instead. Up to five rules run in order, then exposure and contrast, and that stack is remembered in this browser for the next picture. Drag the split across the picture to compare the original with the result, then save a PNG, JPEG or WebP. Pictures up to 24 megapixels are worked on this device and never uploaded.

Replace a color in a picture

PNG, JPEG or WebP up to 24 megapixels. It is read in this browser and never uploaded.

Image
no picture yet
Replace
no rule yet
Tolerance
none
Changed
no picture yet

Colors are the ones this browser decodes from the file, after any color profile it applies. The preview is scaled to fit 1600 px; the count, the probe and the saved file are worked on every pixel at full size. Up to five rules run in order, each matched against the original colors, then exposure and contrast.

  • All settings neutralno rules, exposure 0, contrast 0, saved as PNG
    every pixel identical to the decoded source
  • Pure red #FF0000 to blue #0000FFtolerance 0, feather 0
    only exact #FF0000 pixels become #0000FF; #FE0000 stays as it was
  • Logo pixels at alpha 128transparency replacement off, then on
    off: alpha stays 128 everywhere; on: matched pixels go to alpha 0

Common questions

How do I replace one color with another in an image?
Choose a PNG, JPEG or WebP picture, or drop it on the panel. Press Pick color and click the color you want to change; the pixel under the pointer becomes the selected rule's color to replace, or starts rule 1 when there is none. Set the new color by typing a hex code such as #2E6EC8, by using the color chooser, or with the Pick button beside it to take it from another part of the image. Tolerance decides how different a pixel may be and still be replaced, and feather softens the edge beyond it. The result updates on the right, and PNG, JPEG and WebP save it at the picture's full size.
What do tolerance and feather mean here?
Both are measured as a gap: the largest of the three differences between a pixel's red, green and blue values and the picked color's, on the 0 to 255 scale the browser decodes the picture to. A pixel whose gap is at most the tolerance is replaced completely. Across the feather it is replaced by a falling share, (tolerance + feather - gap) / feather, and from tolerance + feather on it is left alone. With tolerance 40 and feather 20, a pixel 46 away moves 70% of the way to the new color. The probe under the picture shows the gap and that share for the pixel under the cursor.
How does Keep shading work?
It keeps each pixel's brightness relative to the color you picked. The page measures relative luminance in linear light (Rec. 709 weights) for the pixel and for the picked color, and scales the new color's light by that ratio, so a pixel half as bright as the picked red becomes the new color at half its brightness. Where that would push a channel past full brightness, the color is mixed toward white by just enough to keep the same luminance, so highlights stay highlights. A picked color of pure black #000000 has no brightness to divide by, so that rule paints its new color flat and says so. With Keep shading off, every match gets the new color flat.
Can I make a color transparent instead of replacing it?
Yes. Set a rule's with option to Transparent and its matches lose their alpha: fully inside the tolerance they become fully transparent, and across the feather their alpha is multiplied by the share that stays, so edges fade out. The rule leaves their color values alone. Only a rule set to Transparent ever changes alpha; new colors, shading, exposure and contrast leave every alpha value as it was. Save as PNG or WebP to keep the transparency. JPEG has none, so a JPEG is flattened onto white first.
Will it change only the object I click on?
No. There is no object detection: every visible pixel within the tolerance of the picked color is replaced wherever it is in the picture, so a red mug and a red book of the same shade change together. A lower tolerance narrows the match. Fully transparent pixels are always left as they are. Up to five rules run in order, each matched against the original colors, so a later rule never picks up a color an earlier one made, and where two rules match the same pixel the later one is drawn over the earlier.
What do exposure and contrast do?
They run after the color rules, on every visible pixel. Exposure, from -3 to +3 EV, multiplies the light in linear terms by 2 to that power, so +1 doubles it and anything pushed past white stays white. Contrast, from -100 to 100, multiplies each value's distance from mid-grey by 1 + contrast / 100: -100 turns everything mid-grey and +100 doubles the distance. Neither touches alpha, and neither can bring back detail that was lost to shadow, glare or compression.
Which format should I save in?
PNG holds the result exactly: the page writes the file itself from the result's pixels, transparency included. JPEG and WebP are encoded by your browser at the quality you set, from 1 to 100 and 90 to start, which can change pixel values. JPEG has no transparency, so any is flattened onto white. A browser that cannot write WebP hands back a PNG instead; the page checks the file type, says so and saves nothing, so a .webp is never really a PNG. Every file is made from the pixels alone, so camera metadata such as location is not copied into it.
Is my picture uploaded, and how big can it be?
It is not uploaded: the file is decoded by your browser and worked on in this tab. Pictures up to 24 megapixels and 16384 pixels a side are accepted, and a larger file is refused from its header before it is decoded. The preview is scaled to fit 1600 pixels, while the changed count, the probe and every saved file are worked on each pixel at full size. The colors are the ones this browser decodes, after any color profile it applies. Your rules, exposure, contrast and quality are remembered in this browser; the picture never is, and Start over forgets them.

Deterministic filters on the colors this browser decodes: the same settings give the same pixels, and with no rule, exposure 0 and contrast 0 the PNG holds every decoded pixel unchanged. Every visible pixel within the tolerance of a picked color is replaced, whatever object it belongs to, and alpha changes only for rules set to make matches transparent. It cannot recover missing detail or restore a photo the way AI tools claim to; PNG saves the result exactly, while JPEG and WebP are re-encoded by this browser, which can change pixel values.