MATLAB: How to get transparent PNG file from FIG file

figMATLABpngtransparent

How to get transparent PNG file from FIG file?

Best Answer

1. Download the "export_fig" functions from the File Exchange link:
Note that this is a 3rd party File Exchange function, and not officially supported (or tested) by MathWorks.
2. Set the 'Color' property of both figure and axes objects to 'none':
>> plot(1:10)
>> f = gcf;
>> a = gca;
>> f.Color = 'none';
>> a.Color = 'none';
3. Use the "export_fig" function with -transparent' flag to generate the PNG file:
>> export_fig -transparent