[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "Movie" of plots
From: |
John B. Thoo |
Subject: |
Re: "Movie" of plots |
Date: |
Tue, 14 Dec 2004 07:09:15 -0800 |
On Dec 14, 2004, at 6:39 AM, Claudio Belotti wrote:
I think that it's better if you reply to the list, anyway :
I had sent Robert a reply off-list, but Claudio's mention above has
prompted me to send the same reply to the list. [I hope that you don't
mind, Robert.]
On Dec 13, 2004, at 7:12 PM, John B. Thoo wrote:
Perhaps if you can create gifs, you can use something like gifsicle to
create an animated gif.
<http://www.lcdf.org/~eddietwo/gifsicle/>
Robert then asked me how I create gifs. FWIW, here is what I sent him.
I have a rather convoluted way of making gifs (because I refuse to
purchase s/w to do this alone when I don't do this very often).
First, I save my octave plots as .png using this script.
% A. S. Hodel
% Assoc. Prof, Dept. Elect & Comp Eng
% Auburn University, AL 36849-5201
% address@hidden
function printpng(filename,pngsiz,fn)
% function printpng(filename,pngsiz,fn)
% replot screen plot to a file
%
% inputs:
% filename: string:
% pngsiz: "small", "medium" (default), or "large"
% fn: figure number to convert to png form (default: 0)
% no argument checking done
if(nargin < 2)
pngsiz = "small";
elseif(isempty(pngsiz))
pngsiz = "small";
endif
if(nargin < 3)
fn =0;
endif
figure(fn);
cmd = (sprintf(" gset terminal png %s color",pngsiz));
eval(cmd);
cmd = (sprintf("gset output '%s'", filename));
eval(cmd);
replot
closeplot();
endfunction
Second, I open the files in the Gimp and re-save the plots as .xpm.
Third, I run this script.
#!/bin/sh
#
# A script to convert an X11 pixmap into a GIF image
# JBT 2003/1/22
if [ -z "$1" ] ; then
echo 'usage: xpm2gif filename1 filename1 ...'
else
for i in "$@" ; do
filename="$i"
if [ -e ${filename%.*}.xpm ] ; then
xpmtoppm "$i" > "$i".temp1
ppmquant 256 "$i.temp1" > "$i".temp2
ppmtogif "$i".temp2 > "$i".temp3
mv "$i".temp3 `echo "$i" | sed s/\.xpm/\.gif/g`
rm -f "$i".temp1 "$i".temp2 "$i".temp3
else
echo "\"$i\" may not be an X11 pixmap (.xpm) file"
fi
done
fi
Last, I use gifsicle. (You can fix the timing between frames in
gifsicle.)
I'm sure there are simpler ways, and a query to the octave-help (or
other) list may yield them.
HTH.
---John.
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------