
MediaScript Objects and Methods 91
•
•
•
•
getPixelFormat()
Returns a string representing the image type: “Gray-8”, “RGB-15”, “RGB-16”, “RGBA-16”,
“RGB-18”, “RGB-24”, “RGBA-32”, “HSV-24”, “HLS-24”, “CMYK-32”, “CMYKA-40”.
Syntax
<object name>.getPixelFormat();
Parameters
This function has no parameters.
Example
var image = new Media();
image.load(name @ "peppers.psd");
if(image.getPixelFormat() == "RGB-24")
{...
getPixelTransparency()
Returns the value for the alpha channel or 255 if there is no alpha channel. This function
fully supports the media object within the CMYK color space.
Syntax
<object name.>.getPixelTransparency(
X @ <pixel>
Y @ <pixel>
[layers @ <"layer list">] // (PSD files only)
);
Parameters
X and Y - specify the coordinates of the target pixel. The top-left corner of an image is
represented by the coordinates 0,0.
layers - for PSD files, specifies the layers to be included. The layer numbers begin at 0
(background) and go up. For more information see “load()” on page 101.
getPopularColor()
Returns the 24-bit color value (0 - 16,777,215) of the color that appears most frequently in
the named object for the RGB color-space.
Syntax
<object name>.getPopularColor(
[Precise @ <true, false>]
[layers @ <"layer list">] // (PSD files only)
);
Parameters
Precise - if set to “false”, which is the default, the color returned will be a close
approximation of the actual color that appears most often in the image.