ColorTools - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

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

ColorTools

 Convert
 efficiently convert between color spaces

 Calling Sequence Convert(color, outspace) Convert(color, inspace, outspace)

Parameters

 color - color format recognized by ColorTools or an rtable of floats outspace - string specifying a known color space or "RGB24" inspace - (optional) string specifying a known color space or "RGB24". Defaults to "RGB" or, if color is an object, its color space.

Description

 • The primary purpose of the Convert command is to efficiently convert colors represented as lists of floating-point numbers from one color space to another.  However, the color argument can be any supported color format. If only one color space is specified, then the input space is assumed to be "RGB" unless the input color is a Color object.  In addition to all the color spaces supported for Color objects, the Convert command also allows "RGB24" to be used as the inspace or outspace.
 • If color is an rtable it will be interpreted as an $n$ x $3$ array of color coordinates in the input space and an $n$ x $3$ array of coordinates in the output space will be returned.

Examples

 > $\mathrm{with}\left(\mathrm{ColorTools}\right):$
 > $\mathrm{Convert}\left(\left[1,0,0\right],"HSV"\right)$
 $\left[{0.}{,}{1.000000000}{,}{1.00000000}\right]$ (1)
 > $\mathrm{Convert}\left(\left[1,0,0\right],"RGB","HSV"\right)$
 $\left[{0.}{,}{1.000000000}{,}{1.00000000}\right]$ (2)
 > $\mathrm{Convert}\left(\left[0.25,1,1\right],"HSV","RGB24"\right)$
 $\left[{128}{,}{255}{,}{0}\right]$ (3)

If inspace is not given, the input is assumed to be RGB.

 > $\mathrm{Convert}\left(\left[0.25,1,1\right],"RGB24"\right)$
 $\left[{64}{,}{255}{,}{255}\right]$ (4)

Color object inputs implicitly specify inspace.

 > $\mathrm{Convert}\left(\mathrm{Color}\left("HSV",\left[0.25,1,1\right]\right),"RGB24"\right)$
 $\left[{128}{,}{255}{,}{0}\right]$ (5)

Compatibility

 • The ColorTools[Convert] command was introduced in Maple 18.
 • For more information on Maple 18 changes, see Updates in Maple 18.

 See Also