image.scaleToFit()
Creates a resized image with the aspect ratio maintained.
image.scaleToFit( fitWidth=string, fitHeight=string, interpolation=string, blurFactor=number )
Returns: Image
| Argument | Description |
|---|---|
|
fitWidth
string,
required
|
edit
The width of the bounding box in pixels. You can specify an integer, or an empty string ("") if the fitHeight is specified. |
|
fitHeight
string,
required
|
edit
The height of the bounding box in pixels. You can specify an integer, or an empty string ("") if the fitWidth is specified. |
|
interpolation
string,
optional
|
edit
The interpolation method for resampling. You can specify a specific interpolation algorithm by name (for example, hamming), by image quality (for example, mediumQuality), or by performance (for example, highestPerformance). Valid values are:
|
|
blurFactor
number,
optional
|
edit
The blur factor used for resampling. The higher the blur factor, the more blurred the image (also, the longer it takes to resize the image). Valid values are 1-10. |
Examples
edit myImg = imageNew("",400,400,"rgb","70a1ff");
myImg.ScaleToFit(80,"","highPerformance");
cfimage(action="writeToBrowser", source=myImg);