ColorConvert
ColorConvert[image,colspace]
converts the color space of image to the specified color space colspace.
ColorConvert[color,colspace]
converts color specifications of a color directive.
Details


- ColorConvert is typically used to change the color specification of an image. Color spaces are used for different purposes, e.g. CMYK is typically used in printing and Lab is used for color comparison.
- ColorConvert works with colors and arbitrary 2D and 3D images, as well as an explicit list of color channel values.
- ColorConvert[list,…] by default interprets list as follows:
-
{v} gray level {v,α} gray level and parameter
{r,g,b} red, green, blue levels {r,g,b,α} RGB with parameter
- Supported color spaces colspace include:
-
"Grayscale" GrayLevel "RGB" RGBColor "CMYK" CMYKColor "HSB" Hue "XYZ" XYZColor "LAB" LABColor "LCH" LCHColor "LUV" LUVColor 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.
Examples
open allclose allBasic Examples (3)
Scope (9)
Convert an intensity value to grayscale:
Convert an intensity value to RGB:
Convert RGB intensity values to CMYK:
Convert a color to another color space:
Convert a grayscale image to RGB:
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:
Applications (2)
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)
Text
Wolfram Research (2008), ColorConvert, Wolfram Language function, https://reference.wolfram.com/language/ref/ColorConvert.html (updated 2014).
BibTeX
BibLaTeX
CMS
Wolfram Language. 2008. "ColorConvert." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/ColorConvert.html.
APA
Wolfram Language. (2008). ColorConvert. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ColorConvert.html