Clear Filters
Clear Filters

Why the dimensions of my picture in pixels is reduced when I save my image?

3 views (last 30 days)
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.

Accepted Answer

Image Analyst
Image Analyst on 3 Feb 2017
That probably saves the whole figure, not the image. Use imwrite() instead to save the image array only.
  6 Comments

Sign in to comment.

More Answers (1)

John BG
John BG on 3 Feb 2017
if the bpass function is removing samples to low band pass filter, then the resulting image is going to be smaller.
have you checked that images b and im are same size?
John BG
  2 Comments
Aude Rapet
Aude Rapet on 3 Feb 2017
Yes I checked :
>> whos im
Name Size Bytes Class Attributes
im 1038x1388 11525952 double
>> whos b
Name Size Bytes Class Attributes
b 1038x1388 11525952 double

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!