MATLAB: The dimensions of the picture in pixels is reduced when I save the image

dimensionimageimage processingpicturepixelssave

Hi,
I filter an imageA with a function called bpass and then I display it with imagesc to be able to save it (as .tif). ImageA is 1038*1388 pixels, my filtered image is 1038*1388 double as well, but when I save it (right click on the image, save as…), the picture I then open is 560*420 pixels. Why…?
%Read the image
prepreim = imread('well8 aft.tif');
preim = rgb2gray(prepreim); % Convert uint8 color to uint8 gray scale.
im = double(preim); % Convert to double in the range 0-255.
%spatially filter the image
b = bpass(im,1,4);
figure
colormap gray
imagesc(b)
%save the filtered image
figure, colormap gray, imagesc(b);
set(gca,'xtick',[],'ytick',[]); %remove axis
set(gca,'LooseInset',get(gca,'TightInset')); %remove white band
Not to save it manually, I tried to add the line
saveas(gcf,'8beffilter','tiffn');
But in this case I obtain a picture of dimension 875*656 pixels.
Thank you for your help.

Best Answer

That probably saves the whole figure, not the image. Use imwrite() instead to save the image array only.