Shayton Equilibrium Kitchen Utensil 2003 User Manual

Page of 194
MediaScript Objects and Methods 131 
• 
• 
• 
The color can be specified as the background color, or as all pixels of a specified color, index 
value, or color type. In the event that a selection containing everything except a particular 
color is required, the “invert” parameter can be added to the command.
Invert
 - reverses the opacity values of the current selection (for example, 0->255 and 
255->0).
NOTE: 
If the invert parameter is used, it will invert both the opacity and the backcolor, color, and 
index values. If you desire to invert one but not the other, you will need to write separate commands.
Remove
 - de-activates any current selection.
Opacity
 - alters the current level of transparency for the selection. Applying an opacity 
level of 128 will increase the transparency level of the selection by 50%. If reduced, the level 
of the selection cannot be increased again. 
Radius
 - when the backcolor, color, index, or color type parameter is also specified, this 
parameter selects all pixels of colors most similar to the specified color (using the specified 
color as the starting point) and increases the range of similar colors included in the 
selection as the value for Radius increases. The value for this parameter must be higher 
than zero. For example:
image.selection(Color @ 0x008000, Radius @ 20);
This example will create a selection consisting of all the colors in the image that are most 
similar to this color green within a radius of 20.
layers
 - for PSD files, specifies the layers to be included. The layer numbers begin at 0 
Example
var Target = new Media();
var Source = new Media();
Target.load(name @ "peppers.tga");
Source.load(name @ "Bears.tga");
Target.selection(source @ Source, opacity @ 240);
Target.adjustHsb(hue @ 75, saturation @ 75);
Target.save(type @ "jpeg");
s e t C o l o r ( )
Sets the background color, foreground color, and transparency state of an image. Very few 
formats support saving of this information, so this function is primarily used in internal 
calculations in conjunction with other functions such as 
 and 
supports the CMYK color-space.
When an image is initially loaded into memory, the foreground and background colors are 
initialized according to the following order of precedence:
For indexed images:
Background color will be index 0.
Foreground color will be the last indexed color.