save image without the white border

조회 수: 160 (최근 30일)
Xin
Xin 2020년 4월 8일
답변: Image Analyst 2020년 4월 8일
Hello. I would like to save a phot, or any imagesc, pcolor or whatever 2D image. But the problem is that matlab alway automatically leaves a white border somehow. I would like to remove it because I have thousands of photos to process and I cannot crop them manually. I don't quite understand why this is automatically left and there is simply no option in print or saveas to remove the white border.
For example, to generate a random 2D matrix
h = figure(1)
x = rand(50,50);
imagesc(x)
xticks([]);yticks([])
print(['-dpng'],'Fig')
I always get a white border in the end. Could someone give a suggestion on how to remove it. Please, if you want to recommend export_fig, please give an example. This package seems to have no examples in the help. Thanks!

답변 (2개)

KSSV
KSSV 2020년 4월 8일

Image Analyst
Image Analyst 2020년 4월 8일

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by