File Exchange

image thumbnail

Resize N-D arrays and images

version (6.42 KB) by Damien Garcia
Y = RESIZE(X,newsize) resizes input array X using a discrete cosine transform.

1 Download

Updated 12 Oct 2014

View Version History

View License

Y = RESIZE(X,NEWSIZE) resizes input array X using a DCT (discrete cosine transform) method. X can be any array of any size. Output Y is of size NEWSIZE.
Input and output formats: Y has the same class as X.
As an example, if you want to multiply the size of an RGB image by a factor N, use the following syntax:
newsize = size(I).*[N N 1];
J = resize(I,newsize);

% Upsample and stretch an RGB image
I = imread('onion.png');
sizeJ = size(I).*[2 2 1];
J = resize(I,sizeJ);
sizeK = size(I).*[1/2 2 1];
K = resize(I,sizeK);

Enter "help resize" to obtain other examples.

Cite As

Damien Garcia (2021). Resize N-D arrays and images (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (3)

William Warriner

Thank you for this. Useful in my work for voxel array sampling for further use with Floyd-Warshall algorithm. Large voxel arrays take obscene quantities of time with Floyd-Warshall, so periodic sampling is useful.

Thank you also for packaging the two required files.


Nice job! Thanks!!


why do you not put the required functions DCTN and IDCTN into the package as well(?)...


MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!