IMAGERESIZE able to resize an image. You can downsize and also upsize an image using scaling factor.
This is a simple implementation of matlab IMRESIZE code.
Nothing new about this code.
Yes, using a loop without preallocation means this is terribly slow for what should be the most simple interpolation method (nearest-neighbor).
While simplicity has its place, people looking for a image-resizing tool outside of the Image Processing Toolbox shouldn't think that this reflects the approach used by IMRESIZE.
A faster and more flexible IMRESIZE alternative would be to use INTERP2().
%% set axis scaling
img_out=zeros([ceil(sz(1:2).*[yscale xscale]) 3]);
This will work on images with any number of channels, and can use different interpolation methods. It also doesn't require any IPT functions.
That's not to imply that my suggested code replicates IMRESZE behavior either.
for loop is not a good idea in matlab, please try vectorizing it.
Please pre-allocate the img_out variable to speed up your code.