ColorTools - Maple Programming Help

Home : Support : Online Help : Graphics : Packages : ColorTools : Color Format Conversion Commands : ColorTools/ToRGB24

ColorTools

 ToRGB24
 convert a color format to a list of RGB values

 Calling Sequence ToRGB24( input ) ToRGB24( input, colorspace )

Parameters

 input - color format recognized by ColorTools colorspace - string specifying the color space of the input coordinates

Description

 • The ToRGB24 procedure converts from any of the color formats recognized by ColorTools to a list of integer RGB values.  If the input cannot be recognized as a color, an error is thrown.
 • In the second calling sequence, the input must be a list of coordinates in the color space specified by colorspace.  For information on known color spaces, see ColorTools/ColorSpaces.

Examples

 > $\mathrm{with}\left(\mathrm{ColorTools}\right):$
 > $\mathrm{ToRGB24}\left("Red"\right)$
 $\left[{255}{,}{0}{,}{0}\right]$ (1)
 > $\mathrm{ToRGB24}\left('\mathrm{red}'\right)$
 $\left[{255}{,}{0}{,}{0}\right]$ (2)
 > $\mathrm{ToRGB24}\left(\mathrm{Color}\left("HSV",\left[0.,1.,1.\right]\right)\right)$
 $\left[{255}{,}{0}{,}{0}\right]$ (3)
 > $\mathrm{ToRGB24}\left(\left[0,1,1\right],"HSV"\right)$
 $\left[{255}{,}{0}{,}{0}\right]$ (4)
 > $\mathrm{ToRGB24}\left(\left[255,0,0\right]\right)$
 $\left[{255}{,}{0}{,}{0}\right]$ (5)

A list of 0 and 1 integers is ambiguous.  ToRGB24 will treat them as floats.

 > $\mathrm{ToRGB24}\left(\left[0.,1.,0.\right]\right)$
 $\left[{0}{,}{255}{,}{0}\right]$ (6)
 > $\mathrm{ToRGB24}\left(\left[0,1,0\right]\right)$
 $\left[{0}{,}{255}{,}{0}\right]$ (7)

Compatibility

 • The ColorTools[ToRGB24] command was introduced in Maple 16.