Resize
Resize image
1. imgResize lock:=1 unit:=pixel w:=50;
2. imgResize lock:=1 unit:=percent h:=120 interpolate:=resample;
3. imgResize lock:=0 w:=120 h:=130 interpolate:=normal img:=mat(1) oimg:=mat(2);
Please refer to the page for additional option switches when accessing the x-function from script
Display Name |
Variable Name |
I/O and Type |
Default Value |
Description |
---|---|---|---|---|
Lock Proportions | lock |
Input int |
|
Specifies whether or not to keep the aspect ratio of the original image. |
Unit | unit |
Input int |
|
This variable works with two other variables, w and h. It specifies the units for them. Option list
|
Width | w |
Input/Output double |
|
Specifies the width of the output image. |
Height | h |
Input/Output double |
|
Specifies the height of the output image. |
Input Matrix | img |
Input Image |
|
Specifies the source image to be manipulated. The default input is the active image. |
Output Image | oimg |
Output Image |
|
Specifies the output image. By default, it is the same as the input image. See the syntax here. |
Interpolation | interpolate |
Input int |
|
Specifies the interpolation method which is used when the image is resized. Option list
|
This X-Function can be used to resize the input image to any size.
In this example, we use the imgResize function to resize the input image. We change its width to 300 pixels and its height to 200 pixels:
The resizing is implemented with L_SizeBitmap() function from LEADTOOLS Main API. Please refer to the LEADTOOLS Main API Help file, Version 14 and read the L_SizeBitmap topic.
LEADTOOLS Main API Help file, Version 14