converts color specifications in expr to refer to the color space represented by colspace.


  • The expression expr can be a color specification such as RGBColor[] or Red, an Image or Image3D object, or an explicit list of color channel values.
  • ColorConvert[list,] by default interprets list as follows:
  • {v}gray level
    {v,α}gray level and alpha parameter
    {r,g,b}red, green, blue levels
    {r,g,b,α}RGB with alpha parameter
  • Supported color spaces colspace include:
  • "Grayscale"GrayLevel
    ColorProfileData[][i]color profile with the specified rendering intent i
  • When converting to or from "Grayscale", "RGB", "CMYK", and "HSB", channel values are clipped to be between 0 and 1.
  • When converting to and from "XYZ", "LAB", "LUV", and "LCH", channel values are not clipped and when applied to images will result in an image of a real type.
  • ColorConvert automatically performs chromatic (white point) adaptation. D50 white point is assumed for "XYZ", "LAB", "LUV", and "LCH" and D65 for "RGB", "CMYK", "HSB", and "Grayscale".
  • When converting to and from "RGB", the channel values are assumed to be in the sRGB color space.
  • ColorConvert[input,src->dst] can be used to convert to the color space specified by dst, while interpreting channel values in input according to the color space src. Both src and dst can be either a known color space or a color profile.
  • ColorConvert[image,colspace] is equivalent to ColorConvert[image,ImageColorSpace[image]->colspace].
  • Color space specified by src should be compatible with the number of channels in image.
  • If dst is a color profile, one of the device or connection spaces should match the color space of the input or a specified source color space src.


open allclose all

Basic Examples  (6)

Convert a color photo to grayscale:

Convert to CMYK:

This shows that the previous output is a CMYK image:

Convert a 3D image to LCh:

Convert an RGB color object to CMYK:

Convert an intensity value to RGB:

Convert an RGB color object to HSB:

Scope  (4)

Convert from a known color space to Lab:

Specify the color space for the image with an unknown color space and convert to RGB:

Use a color profile to convert to the sRGB version 4 color space:

Specify device profiles for both source and destination:

Specify the rendering intent:

Generalizations & Extensions  (2)

Convert a list of colors:

Convert a list of images:

Applications  (2)

Convert an image to its "LAB" representation and perform custom color negations:

Convert an image to the "LCH" color model to perform specific chroma and hue transformations:

Segment out the three strawberries in the image:

Transform the colors in each image segment and combine the results:

Properties & Relations  (2)

When the destination is specified with a ColorProfileData, the result is in the device color space:

The grayscale representation of an RGB color is equivalent to the luma in the Y'CbCr color model:

Possible Issues  (1)

Conversion using a color profile may result in an approximate color representation:

In such cases converting back to the original color space gives a different color:

This difference may become significant after several conversion steps:

Built-in conversions between RGB and CMYK preserve the color:

Introduced in 2008
Updated in 2012