Previous Page | Next Page

Commands Used with the IMGCTRL, IMGOP and PICFILL Functions

SCALE



Scales an image
Syntax
Details
Example

Syntax

rc=IMGOP(task-id, 'SCALE', width, height<, algorithm>);
region-id=PICFILL(graphenv-id, type, ulr, ulc,
lrr, lrc, source<, 'SCALE'<, arguments>>);

width

is the new width of the image (in pixels).

Type: Numeric

height

is the new height of the image (in pixels).

Type: Numeric

algorithm

specifies which scaling algorithm to use:

BILINEAR

computes each new pixel in the final image by averaging four pixels in the source image and using that value. The BILINEAR algorithm is more computationally expensive than LINEAR, but it preserves details in the image better.

LINEAR

replicates pixels when the image is scaled up and discards pixels when the image is scaled down. The LINEAR algorithm yields good results on most images. However, it does not work very well when you are scaling down an image that contains small, but important, features such as lines that are only one pixel wide. LINEAR is the default.

Type: Character


Details

SCALE acts on the currently selected image. It scales the image to a new image. If you specify -1 for either width or height, then SCALE preserves the image's aspect ratio.


Example

Double the size of an image:

main:
   rc=imgop(task-id,'READ',path);
   rc=imgop(task-id,'QUERYN','WIDTH',width);
   rc=imgop(task-id,'SCALE',2*width,-1);
   rc=imgop(task-id,'PASTE');
return;

Previous Page | Next Page | Top of Page