Saving an imagesc file as .png without the white borders?
17 views (last 30 days)
I want to save a series of images that output in the format 'matlab.graphics.primitive.image' as PNGs without that white border PNGs save with. My code is below--is there any way to output these images cropped of their white border? I've already tried setting my 'iptsetpref' as 'tight', to no avail.
Sudheer Bhimireddy on 6 Aug 2020
By white border if you mean the background outside the figure, then you would have to export it to epsc format
DGM on 3 Aug 2022
Edited: DGM on 3 Aug 2022
If you have an image and want to save the image, save the image. Don't display the image and then save a screenshot of the displayed image. Don't display the image and then take a photo of the monitor with your phone. Don't describe the image as a thousand words of poetry or as an interpretive dance.
Save the image array -- not the graphics object or the parent figure. Use imwrite(). Anything else is not just self-inflicted inconvenience; it's often destructive.