A SERVICE OF

logo

MediaScript Objects and Methods 149
Parameters
Alg - specifies the algorithm that will be used. The default algorithm is fast. The outline
algorithm should be used for black and white images only.
Xs and Ys - specify the destination size of the media. The resulting image always fits these
dimensions regardless of the scale and the source media.
X and Y - specify the position of the top-left corner of the region to be zoomed. These
coordinates are specified relative to the destination media at scale @ 1.
Scale - specifies a real value and gives the magnification of the resulting image. For a
value of “1”, the whole media fits within the specified size.
PreserveBackground - when scaling an image that contains an object surrounded by a
solid background color, setting this parameter to “true” avoids anti-aliasing the edge of the
object with the background. Anti-aliasing is a method of eliminating jagged edges by
blending pixel colors with the background. When working with an object on a solid
background, however, most users find it preferable to maintain a sharp, clean edge,
because the blending can often produce an undesired halo effect.
PreserveBackgroundCutoff - specifies the threshold for PreserveBackground. The
default threshold percentage is 67%, which means that the background color will be
preserved unless 67% or more of the pixels use the background color.
Padcolor or Padindex - specifies the color to be used where the new image dimensions
extend beyond the current image. If a pad color is not specified, the image’s background
color is used by default. For more information about setting an image’s background color,
see setColor().
Transparency - specifies the transparency (255 is opaque and 0 is transparent) of the
padded area’s alpha channel. This parameter is useful when the cropped image is used in
a composite().
NOTE: If the cropped image is not 32-bit before cropping, the transparency information is not used
on the next composite() function.
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.
Example
var image = new Media();
image.load(name @ "pasta.tga");
image.zoom(xs @ 100, ys @ 100, scale @ 2, x @ 20, y @ 30);
image.save(name @ "Result.tga");