Thread Subject: avoid white region while saving image from matlab

Subject: avoid white region while saving image from matlab

From: Khanh

Date: 23 Jun, 2011 00:44:04

Message: 1 of 3

I currently use "saveas" function to save images to my folder. However, all images have white region around it. I'm not sure how to avoid matlab to save this waste memory. Thanks in advanced!

Subject: avoid white region while saving image from matlab

From: ImageAnalyst

Date: 23 Jun, 2011 01:25:12

Message: 2 of 3

On Jun 22, 8:44 pm, "Khanh " <kdc...@mtu.edu> wrote:
> I currently use "saveas" function to save images to my folder. However, all images have white region around it. I'm not sure how to avoid matlab to save this waste memory. Thanks in advanced!

----------------------------------------------------------
Yes, MATLAB figures usually have huge amounts of blank space around
them - I don't know why. Try export_fig, mentioned in the FAQ:
http://matlab.wikia.com/wiki/FAQ#How_do_I_save_my_figure.2C_axes.2C_or_image.3F_I.27m_having_trouble_with_the_built_in_MATLAB_functions.

Subject: avoid white region while saving image from matlab

From: vedenev

Date: 23 Jun, 2011 04:06:00

Message: 3 of 3

It is default axes box size, you can increase it, example:

x=0:0.01:1;
y=x.^2;
plot(x,y,'r');

% increase axes box:
incf=1.15; % increase factor
pos=get(gca,'position');
% center:
xc=pos(1)+pos(3)/2;
yc=pos(2)+pos(4)/2;
posi=[xc-incf*pos(3)/2 yc-incf*pos(4)/2 incf*pos(3)
incf*pos(4)]; % increased
set(gca,'position',posi);

saveas(gcf,'example.png');

------------------------------------
Maxim Vedenev, Matlab freelancer
vedenev@ngs.ru
http://simulations.narod.ru/

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
saveas Khanh 22 Jun, 2011 20:49:08
image Khanh 22 Jun, 2011 20:49:08
rssFeed for this Thread

Contact us at files@mathworks.com