MATLAB: How to remove the grey borders from the IMSHOW plot in MATLAB 7.4 (R2007a)

bordergraygreyimshowMATLAB

When I display an image using IMSHOW I get grey borders. For my application I want to remove the borders such that the figure window should only display the image.

Best Answer

You can do this using the following set of commands:
imshow('board.tif')
This could be implemented as follows:
set(gca,'units','pixels') % set the axes units to pixels

x = get(gca,'position') % get the position of the axes
set(gcf,'units','pixels') % set the figure units to pixels
y = get(gcf,'position') % get the figure position
set(gcf,'position',[y(1) y(2) x(3) x(4)])% set the position of the figure to the length and width of the axes
set(gca,'units','normalized','position',[0 0 1 1]) % set the axes units to pixels