Q:
Hi there,
Whenever I save a figure using:
imshow(I)
print frame1.tif -f1 -dtiff
or by using:
h = imshow(I)
saveas( h, 'frame1.tif', 'tif' )
, I always get a white border around the image (which is
present in the figure window). Does anyone know how to just
save the image itself with no border around it?
===
A:
>>set(gca, 'position', [0 0 1 1], 'visible', 'off')
>> print(3,'-djpeg','C:\Documents and Settings\My Documents\3.jpg');
======
Also
用matlab保存图片的四种方法:
1 直接从菜单保存,有fig,eps,jpeg,gif,png,bmp等格式。
2 edit------〉copy figure,再粘贴到其他程序。
4 使用plot函数后紧接着用print函数。
print的三个参数:
(1)图形句柄,如果图形窗口标题栏是“Figure 3”,则句柄就是3.(2)单引号字符串,指定存储格式。
用gcf可以获取当前窗口句柄。
png格式:'-dpng'
jpeg: '-djpeg',
tiff: '-dtiff'
bmp: '-dbitmap'
(3)文件名。
详细用法请 help print
例:
>> x=-pi:2*pi/300:pi;
>> y=sin(x);
>> plot(x,y);
>> print(gcf,'-dpng','abc.png') % 保存为png格式的图片。
>> figure(2) % 新建一个句柄为2的图形窗口。
>> plot(x,cos(x)); % 在句柄为2的图形窗口上画图。
>> grid
>> print(2,'-djpeg','C:\abc.jpeg'); %将句柄为2的图形保存为jpeg/jpg格式的图片,文件名为'C:\abc.jpeg'。
No comments:
Post a Comment