save image without the white border

151 ビュー (過去 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 Center および File ExchangeConvert Image Type についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by