#!/bin/bash
# Author: Nico Schottelius ( nicos@pcsystems.de )
# Date: 14th of March 2k+1
# LastChanged: 15th of March 2k+1
# Copying: See GNU GENERAL PUBLIC LICENSE ; Version 2, June 1991 
# Descripton: JPEG to GIF
# This script uses the Blender output (JPEG files) and makes
# an gif-animation of them


# Set the filename of the animated gif
FILE="LA.gif"

# unset this
THEGIFS=""

for i in $@
do
  
  # First convert the JPEG Output to PNM image
  jpegtopnm $i > $i.pnm

  # then convert the pnm to gif
  pnmtogif $i.pnm > $i.gif

  # Add the filename to the pseudo matrix
  THEGIFS="$THEGIFS $i.gif" 
  
done

whirlgif -o $FILE $THEGIFS