#!/bin/sh # usage: flattengif file # description: replaces an animated gif file.gif by a # single-framed gif file, where the frames are stacked above each other. # This is useful for example when a PS document file.ps has been # translated into a gif with convert but the document should # be seen as one gif document. # needs the ppm routines to concatenate the gifs as well as gifsicle, # to extract the frames from the movie # Oliver Knill, October 3, 2000 gifsicle -e $1.gif if test -f $1.gif.001 then echo "the gif file has many frames" else echo "the gif file has only one frame" fi for i in $1.gif.*; do convert $i $i.ppm; rm $i; done mv $1.gif.000.ppm first.ppm if test -f $1.gif.001.ppm then for i in $1.gif.*.ppm; do pnmcat -topbottom first.ppm $i>out.ppm; mv out.ppm first.ppm; done fi ppmquant 256 first.ppm>out.ppm; mv out.ppm first.ppm; ppmtogif first.ppm >$1.gif rm *.ppm