
122 Chapter 3
•
•
•
•
rotate()
Rotates the media by the specified angle in degrees. This function fully supports the CMYK
color-space.
Syntax
rotate(
Angle @ <value 0 to infinity>
[ResizeCanvas @ <true, false>]
[Smooth @ <true, false>]
[Xs @ <pixels>]
[Ys @ <pixels>]
[layers @ <"layer list">] // (PSD files only)
);
Parameters
Angle - specifies the number of degrees the image will be rotated. Positive numbers rotate
clockwise and negative numbers rotate counter-clockwise.
ResizeCanvas - provides for the canvas of the image to be automatically enlarged in
order to encompass the rotated image. The additional area uses the image’s background
color. For more information about setting an image’s background color, see setColor().
NOTE: The Enlarge parameter has been deprecated.
Smooth - provides for smooth edges when rotating to something other than right angles.
Xs and Ys - specify how the image will be cropped after it is rotated.
layers - for PSD files, specifies the layers to be affected. 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.rotate(angle @ 45, smooth @ true);
image.save(type @ "jpeg");