imresize
Resize image by scale or output size
📝Syntax
img2 = imresize(img, scale)
img2 = imresize(img, [numrows numcols])
[Y, newmap] = imresize(X, map, ...)
... = imresize(..., method)
... = imresize(..., Name, Value)
📥Input Arguments
Parameter Description
img Image to be resized, specified as a numeric array, logical array of any dimension. Input must be nonsparse, and numeric input must be real.
scale Resize factor, specified as a positive number or two-element vector. If scale is between 0 and 1, output is smaller; if greater than 1, output is larger. imresize applies the same scale factor to row and column dimensions unless a vector is specified.
[numrows numcols] Row and column dimensions of output image, specified as a two-element vector of positive numbers. NaN can be used for either dimension to preserve aspect ratio.
X Indexed image to be resized, specified as a real, nonsparse numeric array of positive integers.
map Colormap associated with indexed image X, specified as a c-by-3 numeric matrix with values in [0, 1].
method Interpolation method (optional, default: 'bicubic'): must be always at last position parameter.
Name, Value Optional name-value arguments.
📤Output Arguments
Parameter Description
B Resized image, returned as a numeric, logical array of the same data type as the input image, A.
Y Resized indexed image, returned as a numeric array of the same data type as the input indexed image, X.
newmap Colormap of the resized indexed image Y, returned as an m-by-3 numeric matrix. By default, imresize returns a new, optimized colormap with the resized image. To return the original colormap, use the Colormap name-value argument.
📄Description

The imresize function resizes an image by a specified scale factor or to a specified output size. It supports grayscale, RGB, binary images, as well as indexed images with colormaps.

For numeric and logical images, the default interpolation method is 'bicubic'.

When resizing, imresize applies the scale factor to both row and column dimensions unless a two-element vector is specified. If the output size is not an integer, imresize rounds up using the ceil function.

For indexed images, imresize returns the resized image and an optimized colormap by default. The original colormap can be returned using the 'Colormap' name-value argument.

Supported interpolation methods include

Supported Pairs Name, Value:

Limitations:

💡Examples
imresize example
filename = [tempdir, 'apollo_8_earthrise_1968_as08-14-2383.jpg'];
websave(filename, 'https://www.nasa.gov/wp-content/uploads/2025/05/3dmodels-casa-2025-astro.jpg');

im = imread(filename);
size(im)

im1 = imresize(im, 0.05, 'bicubic');
size(im1)

figure;

subplot(1,2,1);          % 1 row, 2 columns, first subplot
image(im);
title('Original Image');

subplot(1,2,2);          % second subplot
image(im1);
title('Resized Image');
Example illustration
🔗See Also
imrotateimshow
🕔Version History
Version Description
1.15.0 initial version
Edit this page on GitHub