MATLAB: Does the exported figure in MATLAB 6.5 (R13) not retain the transparent background

.jpgbackgroundexportfigurejpegMATLABprinttiftifftransparent

Why does my exported figure in MATLAB 6.5 (R13) not retain the transparent background?
For example:
figure('Color', 'r'); plot(1:3)
set(gcf,'Color', 'none')
set(gcf,'InvertHardCopy','off')
print -djpeg xxx.jpg
xxx.jpg gets created with a gray background color. I can see it clearly, if, for example, I create a blue rectangle in a PowerPoint slide and insert my xxx.jpg picture on top.
The same situation is with exporting to TIFF format.

Best Answer

The ability to export figures with transparent backgrounds in the JPEG,TIFF,BMP and PNG formats is not available in MATLAB.
To work around this issue, export your figure to EPS-file format. For example:
figure('Color', 'r'); plot(1:3)
set(gcf,'Color', 'none')
set(gcf,'InvertHardCopy','off')
print -deps xxx.eps
The JPEG-file and TIFF-file formats do not support transparency.
To export a figure with a transparent background to the PNG format, please refer to the workaround suggested in the bug report: