
MediaScript Objects and Methods 137
•
•
•
•
Parameters
The first parameter specifies the layer in the target image that gets its pixels replaced. The
default is the first layer (starting from zero).
The second parameter specifies the source Media object. Before you can use
setLayerPixels() you must load() the source image. If the source image has multiple
layers, the first one is used.
Example
var Target = new Media();
var Source = new Media();
Target.load (name @ "banner.psd");
Source.load (name @ "fishes.psd");
Target.setLayerPixels(3,Source);
Target.save(type @ "jpeg");
setLayerX()
Sets the X composite offset of the media layer with the specified index (if available).
Syntax
<object name>.setLayerX(
<layer index>
<position>
);
Parameters
The first parameter specifies the desired layer index (starting from zero).
The second parameter specifies the position of the selected layer along the x-axis of the
composite image, with the layer’s center point used as the anchor point. For example, a
value of 50 positions the center point at pixel 50 on the x-axis of the composite image.
Example
var image = new Media();
image.setLayerX(2, 50);
setLayerY()
Sets the Y composite offset of the media layer with the specified index (if available).
Syntax
<object name>.setLayerY(
<layer index>
<position>
);
Parameters
The first parameter specifies the desired layer index (starting from zero).