Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter TenGraphic and Image Functions (continued)

ImageResizePercent Function

Overview

The ImageResizePercent function resizes an Image object based on a percentage value.

Syntax/Parameters

Syntax

int = ImageResizePercent ( handle hImage, [int size] | [int width, int height] );

Parameters

hImage

A handle to an Image Object.

size

An integer specifying size as a percent to enlarge or reduce the image. When a single parameter is used, the aspect ratio is maintained.

width height

Two integers specifying size as a percent to enlarge or reduce the image for width and height separately. When both parameters are used, the aspect ratio is not maintained unless height and width percent are the same.

Return Value

Returns an int value as ERROR_NONE or a formatted error code.

Remarks

The ImageResizePercent function operates in one of two ways: either the function is supplied a single size parameter or it is supplied both a width and a height parameter. In the first case, the function resizes the image based on the percentage supplied. For example, if the original image is 50 pixels by 100 pixels and a value of 50 is passed to the function, the resultant image will be 25 pixels by 50 pixels. The aspect ratio is maintained. If two sizing parameters are passed to the function, it will resize the image’s height and width accordingly, and it is up to the programmer to maintain the aspect ratio. Passing a value of 100 will cause the function to leave one or both dimensions as is.

Note that resizing the image requires two chunks of memory: memory for the existing image and new memory for the new image. This can result in memory errors if the result plus the source is too large. Because of the nature of the operation the memory must be contiguous.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic