Home > bioelectromagnetism > save_png.m

save_png

PURPOSE ^

save_png - Save figure to PNG file

SYNOPSIS ^

function save_png(file,F, res)

DESCRIPTION ^

 save_png - Save figure to PNG file
 
 Usage: save_png(file,F,res)
 
 'file'    - the string filename
 'F'       - a figure handle, when empty uses 'gcf'
 'res'     - resolution, 600 dpi default
 
 Outputs Portable Network Graphics (600 dpi)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function save_png(file,F, res)
0002 
0003 % save_png - Save figure to PNG file
0004 %
0005 % Usage: save_png(file,F,res)
0006 %
0007 % 'file'    - the string filename
0008 % 'F'       - a figure handle, when empty uses 'gcf'
0009 % 'res'     - resolution, 600 dpi default
0010 %
0011 % Outputs Portable Network Graphics (600 dpi)
0012 %
0013 
0014 % $Revision: 1.1 $ $Date: 2004/11/12 01:32:35 $
0015 
0016 % Licence:  GNU GPL, no implied or express warranties
0017 % History:  02/2003, Darren.Weber_at_radiology.ucsf.edu
0018 %
0019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0020 
0021 if exist('F','var'),
0022     if isempty(F), F = gcf; end
0023 else
0024     F = gcf;
0025 end
0026 if exist('file','var'),
0027     if isempty(file), error('no filename'); end
0028 else
0029     error('no filename');
0030 end
0031 if exist('res','var'),
0032     if isempty(res), res = 600; end
0033 else
0034     res = 600;
0035 end
0036 
0037 
0038 
0039 driver = '-dpng';
0040 option1 = '-noui';
0041 option2 = sprintf('-r%d',res);
0042 %option3 = '-zbuffer';
0043 fprintf('saving to:...%s\n',file);
0044 print(F,driver,option1,option2,file);
0045 
0046 return

Generated on Mon 15-Aug-2005 15:36:19 by m2html © 2003