#!/bin/echo Source only script
#  vim:set syntax=sh:
#
# Global Options for image example generation
#
cmd_found() {
  case "`type $1 2>&1`" in *'not found'*) return 1 ;; esac; return 0
}
cmd_found convert || {
  echo >&2 "IM convert command missing -- ABORTING"
  exit 10
}

while [  $# -gt 0 ]; do
  case "$1" in
  -f) export FORCE=true ;;         # generate random images (do not restore)
  -n) export NO_RECOVER=true ;;    # do not recover if unchanged
  -c) export CLEAR=true ;;         # clear any old backups after compare
  -m) export MAJOR=true ;;         # Only keep backups with major changes
  -v) export VERBOSE=true ;;       # be more verbose
  -d) export VERBOSE=true DEBUG='set -x;' ;;  # verbose debugging
  -s) export SKIP=true ;;          # skip blocks from the start
  -t) export TEST=IM ;;            # set test environment
  -7) export TEST=IMv7 ;;          # set test environment
  -*) echo >&2 "Unknown option \"$1\""
      echo >&2 "Usage: generate [option]"
      echo >&2 "  -f  force the geneation of random images"
      echo >&2 "  -n  do not recover images that were unchanged"
      echo >&2 "  -c  clean the old backups when finished"
      echo >&2 "  -m  only keep the backups of major changes"
      echo >&2 "  -v  verbose output of commands being executed"
      echo >&2 "  -d  include shell debugging for commands"
      echo >&2 "  -s  skip command blocks, until turned off by a block"
      echo >&2 "  -t  Set test environment for commands"
      echo >&2 "  -7  IMv7 test environment for commands"
      exit 10 ;;
  *)  break ;;  # end of user options
  esac
  shift   # next option
done

page_bg_color=LightSteelBlue
txt_bg_color='#cccccc'

#png_format='-depth 8 -quality 95'
#png_format='png8:'
#jpg_opt='-quality 95%'
#jpg_opt='-quality 100%'
#jpg_opt='-quality 100% -compress LossLess'  # not universal, don't use
#gifsicle=true      # DO NOT USE -- sets GIF format to GIF87A

umask 022   # make all files generated world readable


