# 2.15.9 cvResize

Image: Resize...

## Brief Information

Resize an image.

Minimum Origin Version Required: 2022

## Command Line Usage

 1. cvresize width:=100; 

2. cvresize width:=50 height:=50; 

3. cvresize interp:=cubic w:=500 h:=437; 

## Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Input Image img

Input/Output

ImageLayer

<active>
Select the image to resize. Video is not supported.
Keep Aspect Ratio aspect

Input

int

1
Check this checkbox to keep aspect ratio of the source image.
Width w

Input

int

0
Specify the image width after resizing. If Keep Aspect Ratio is selected, Height will be updated accordingly.
Height h

Input

int

0
Specify the image height after resizing. If Keep Aspect Ratio is selected, Width will be updated accordingly.
By a Factor f

Input

double

1
Resize the image (both Width and Height) by the specified factor.
Interpolation Method interp

Input

int

1
Specify the interpolation method used when the image is resized. Option list:
• near:Nearest Neighbor(0)
Uses nearest neighbor interpolation to resize the image.
• linear:Bilinear(1)
Uses bilinear interpolation and averaging to produce a high-quality image. It is usually used to enlarge the image.
• cubic:Bicubic(2)
Uses bicubic interpolation and averaging to produce a high-quality image. It is slower than Bilinear but provides a higher quality. It is usually used to enlarge the image.
• area:Pixel Area Relation(3)
Uses pixel area relation to resize the image. It is usually used to shrink the image.
• lanczos:Lanczos(4)
Uses Lanczos interpolation to resize the image. The resized image may have out-of-range values.

## Description

This X-Function is used to resize the image to a customized height and width according by specified interpolation method.

## Examples

Example 1. Resize the image using Lanczos interpolation method

1. When the image is active, select menu Image: Resize....
2. In the dialog, change the settings as the screenshot below and click OK to close the dialog.

The image is resized down to the half of the original.

## Algorithm

The computation uses function from OpenCV Main API. Please refer to the OpenCV Main API Help file, Version 2.4.11.0 and read imgproc. Image Processing topic.

## References

OpenCV Main API Help file, Version 2.4.11.0