A SERVICE OF

logo

MediaScript Objects and Methods 61
Example
var image = new Media();
image.load(name @ "car.tga");
image.selection(name @ "mskcar.tga");
image.colorize(color @ 0x009900);
image.save(type @ "jpeg");
colorFromImage()
The specified color is converted to the colorspace defined by the destination profile from
the colorspace defined by the source profile and returned to the caller. By default, the
source profile is the profile embedded in the image. The specified rendering intent is used
for the conversion. A source profile may be supplied, and is used if the image has no
embedded profile or if the OverrideEmbedded parameter is specified as true.
Syntax
colorFromImage(
color @ <color in hexadecimal, rgb, or cmyk>
[sourceProfile @ <"filename.icc">]
[destProfile @ <"filename.icc">]
[intent @ <"rendering intent">
);
Parameters
color - specifies the to color to convert using its hexadecimal or rgb value.
sourceProfile - specifies the profile used for the source colorspace. Use this parameter
to define the color specified in the color parameter if the image has no embedded profile or
if the OverrideEmbedded flag is set to true. Otherwise, the specified color is defined by
the embedded profile.
destProfile - specifies the profile used for the destination colorspace.
NOTE: For more information, see the section about specifying ICC profiles in colorCorrect()
on page 59.
intent - the rendering intent to use for the conversion. This is an optional parameter.
Example
rgbColor = image.colorFromImage(color @ 0x00aaaa00,
DestProfile @ "rgb");