Since wcompress works only on images of sizes with power of 2, you could either
- resize the images to a particular size like (256, 512 etc)
- pad the images with zeros
You can use padding if you do not want any loss of information in the images, as resizing might change the original information in the images.
im = imread('path/to/image');
new_im = imresize(im, [256, 256]);
[m, n] = size(im,1:2);
new_m = (256-m)/2;
new_n = (256-n)/2;
new_im = padarray(im, [new_m, new_n]);
For more information on imresize and padarray, you can refer to the following links:
Best Answer