recolors pixels in image specified by region using the specified color.
recolors multiple regions.
Details and Options
- ImageRecolor can be used to replace pixels in a region with a solid color or a region consisting of shades of one color with shades of another color.
- ImageRecolor works with arbitrary 2D and 3D images.
- The region can be specified using any of the following:
col pixels with values close to col maskimage grayscale or binary mask image ColorsNear[col,…] pixels defined by a specific ColorsNear object ImageMarker[markerimage] marker image used to compute the color to be replaced
- Use ImageRecolor[img,col1col2] to swap two colors.48228161
- The following options can be given:
DistanceFunction Automatic color distance metric to use MaxColorDistance 0.1 maximum distance from the reference color Method "BrightnessPreserving" method to use
- DistanceFunction supports all the distance metrics available in ColorDistance.
- Possible settings for Method include:
"BrightnessPreserving" replace hue and saturation, preserving the brightness "SaturationPreserving" replace brightness and hue, preserving the saturation "HuePreserving" replace brightness and saturation, preserving the hue "Brightness" replace brightness only "Saturation" replace saturation only "Hue" replace hue only
Examplesopen allclose all
Use MaxColorDistance to define the maximum distance from the reference color:
Use Method to specify a replacement target:
Properties & Relations (7)
Smaller values of MaxColorDistance allow finer control:
Using TwoWayRule is equivalent to two successive recolorings:
ColorReplace is used to replace a color region with an exact color:
ImageRecolor by default preserves the brightness of the replaced colors:
ImageRecolor performs the replacement in the region defined by the reference color:
ColorBalance scales every color in the image to match the reference color with the destination color:
FindMatchingColor can be used to improve reference color selection. Recolor yellow regions of an image: