function png2gif(png, gif) % PNG2GIF - Create a gif file from a png file % % Use as: png2gif(png, gif) % Inputs: png = Name of png image file to be converted % gif = Name of the gif file to write to. % % PNG2GIF uses Matlab's java interface to call the static method % 'convert' in the java class 'PngToGif'. It requires two freely % available java packages and the class PngToGif to be on MATLAB's % classpath: % % The packages required are: % 1. The java PNG library to decode PNG images. Distributed under the % GNU GPL. http://www.visualtek.com/PNG/index.html % 2. ACME java library to encode the GIF images. Distributed free for % any kind of use (Commercial, Educational, whatever). % http://www.acme.com/resources/classes/Acme.tar.Z % 3. PngToGif.class % % The following is a quote from Matlab's solution seach: % For MATLAB to see your classes they must be in a directory on % MATLAB's classpath (that's classpath, NOT MATLABPATH). MATLAB's % classpath is kept in a file called classpath.txt in your % toolbox/local directory (type which classpath.txt at the MATLAB % prompt). Add the full path to the directory containing your .class % files to this file. Classpath.txt is only read once when MATLAB % starts, so changes to it or your .class files require you to restart % MATLAB before they will take effect. if nargin < 2 error('Usage: png2gif(PNGFileIn,GIFFileOut)'); end java('on'); java_method('convert', 'PngToGif', png, gif);