ColorReplace

ColorReplace[image,color]

finds regions in image whose pixel values are similar to color and replaces them with transparent pixels.

ColorReplace[image,colorreplacement]

replaces all pixels with the specified replacement color.

ColorReplace[image,colorreplacement,d]

replaces all pixels whose values are within a distance d from color.

ColorReplace[image,{color1replacement1,},{d1,}]

does multiple color replacements.

Details

Examples

open allclose all

Basic Examples  (2)

Replace a background with transparency:

Replace black pixels in an image:

Scope  (4)

Use a selected color to specify the pixel values to be replaced:

Use a marker image to specify the pixel values to be replaced:

Specify a distance value:

Specify multicolor replacement and a default background:

Replace red pixels in a 3D image:

Applications  (4)

Green screen replacement:

Change the plot color:

Also remove the axes:

Remove background colors with white:

Shuffle colors on a logo by random color replacement:

Find dominant colors in the image and generate random replacement:

Replace colors:

Properties & Relations  (2)

Replacing pixels of a grayscale image with color values will result in a color image:

Use DominantColors to find the dominant green color to be replaced:

Replace the detected shade of green with transparent:

Wolfram Research (2012), ColorReplace, Wolfram Language function, https://reference.wolfram.com/language/ref/ColorReplace.html (updated 2014).

Text

Wolfram Research (2012), ColorReplace, Wolfram Language function, https://reference.wolfram.com/language/ref/ColorReplace.html (updated 2014).

BibTeX

@misc{reference.wolfram_2020_colorreplace, author="Wolfram Research", title="{ColorReplace}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/ColorReplace.html}", note=[Accessed: 02-March-2021 ]}

BibLaTeX

@online{reference.wolfram_2020_colorreplace, organization={Wolfram Research}, title={ColorReplace}, year={2014}, url={https://reference.wolfram.com/language/ref/ColorReplace.html}, note=[Accessed: 02-March-2021 ]}

CMS

Wolfram Language. 2012. "ColorReplace." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/ColorReplace.html.

APA

Wolfram Language. (2012). ColorReplace. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ColorReplace.html