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:

Introduced in 2012
 (9.0)
 |
Updated in 2014
 (10.0)