
128 Chapter 3
•
•
•
•
scale()
Scales the image to the specified size. This function fully supports the CMYK color-space.
Syntax
scale(
[Alg @ <"Fast", "Smooth", "Outline", "Best">]
[Constrain @ <true, false>]
[Xs @ <pixels>, <percentage + "%">]
[Ys @ <pixels>, <percentage + "%">]
[X1 @ <pixels>]
[Y1 @ <pixels>]
[X2 @ <pixels>]
[Y2 @ <pixels>]
[PreserveBackground @ <true, false>]
[PreserveBackgroundCutoff @ <value 0..100>]
[PadColor @ <color in hexadecimal or rgb>]
[PadIndex @ <value 0..16777215>]
[Transparency @ <value 0..255>]
[TransparentCutoff <-1, 0..255>]
);
Parameters
Alg - specifies the algorithm that will be used. The default algorithm is fast. The outline
algorithm is designed for black and white images only. The effect of the best algorithm is
most apparent when scaling upward -- it uses a spline algorithm, giving superior results,
but is slower than both the fast and smooth algorithms.
Constrain - specifies that the ratio between xs and ys is maintained relative to the
original image. If Xs and Ys values are specified and constrain is set to true, the image size
will be padded to preserve the aspect ratio of the source. If the padColor parameter is not
set then the padcolor is determined by the backcolor.
Xs and Ys - specify the size of the generated image, either as an absolute (in pixels), or as
a percentage of the selection in the original. Use X1, Y1, X2, and Y2 to specify the selected
area. If no area is selected, the percentage is based on the original image size.
NOTE: Putting a percentage sign after the number signifies a percentage. Where either xs or ys is
not specified, the original dimension is assumed.
X1 and Y1 - represent the upper left corner of the area to be scaled. The default is the
original image’s upper left corner.
X2 and Y2 - represent the lower right corner of the area to be scaled. The default is the
original image’s lower right corner.
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.