Image Processing Toolbox    

Image Resizing

The toolbox function imresize changes the size of an image using a specified interpolation method. If you do not specify an interpolation method, the function uses nearest neighbor interpolation.

You can use imresize to resize an image by a specific magnification factor. To enlarge an image, specify a factor greater than 1. For example, the command below doubles the number of pixels in X in each direction.

To reduce an image, specify a number between 0 and 1 as the magnification factor.

You can also specify the actual size of the output image. The command below creates an output image of size 100-by-150.

If the specified size does not produce the same aspect ratio as the input image has, the output image will be distorted.

If you reduce the image size and use bilinear or bicubic interpolation, imresize applies a low-pass filter to the image before interpolation. This reduces the effect of Moiré patterns, ripple patterns that result from aliasing during resampling. Note, however, that even with low-pass filtering, the resizing operation can introduce artifacts, because information is always lost when you reduce the size of an image.

imresize does not apply a low-pass filter if nearest neighbor interpolation is used, unless you explicitly specify the filter. This interpolation method is primarily used for indexed images, and low-pass filtering is not appropriate for these images.

For information about specifying a different filter, see the reference page for imresize.


 Image Types Image Rotation