I have quite a lot of 224×289 images that I want to save. I want to avoid wasting space with borders. Preferably the resulting images should all have the same size including their colorbar + colorbar title + figure title. Here is the code
figure(1);imshow(image,range);title('title');c = colorbar;c.Label.String = 'Gray value';
I tried saving with
iptsetpref('ImshowBorder','tight')saveas(gcf,'name.png')
but it cuts away the title.
When saving with
set(gcf, 'PaperUnits', 'centimeters');set(gcf, 'PaperPosition', [0 0 15 10]); %x_width=10cm y_width=15cm
saveas(gcf,'fig1.tif')
I tried to find reasonable values for width etc but I cannot for the life of me get the figure to show the colorbar with title AND the figure's title. Something always gets cut.
Can someone tell me how I could set my image size by hand or cut the image so that the margins are outside of my title and colorbar title?
Best Answer