save image without the white border

178 visualizaciones (últimos 30 días)
Xin
Xin el 8 de Abr. de 2020
Respondida: Image Analyst el 8 de Abr. de 2020
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!

Respuestas (2)

KSSV
KSSV el 8 de Abr. de 2020

Image Analyst
Image Analyst el 8 de Abr. de 2020

Categorías

Más información sobre Convert Image Type en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by