File: ps2gif

package info (click to toggle)
hyperlatex 2.5-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 480 kB
  • ctags: 288
  • sloc: lisp: 2,291; sh: 180; makefile: 86; awk: 21
file content (51 lines) | stat: -rwxr-xr-x 946 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#! /bin/sh
# convert ps file to Gif
#
resolution=95
quantcmd="cat"
transcmd="-transparent #ffffff "
antialiasing=""
#
usage() {
  echo "Usage:" 1>&2
  echo "  ps2gif [ -res RESOLUTION ] [ -notrans ] psfile.ps" 1>&2
  echo " " 1>&2
  exit 1
}

[ $# -lt 1 ] && usage

while [ $# -gt 0 ]; do
  case $1 in
    -quant)
      quantcmd="ppmquant 50"
      ;;
    -notrans)
      transcmd=""
      ;;
    -antialiasing)
      antialiasing="-dTextAlphaBits=4 -dGraphicsAlphaBits=4"
      ;;
    -res)
      shift
      if [ $# -eq 0 ]; then
        echo "ps2gif: no resolution specified" 1>&2
        exit 1
      fi
      resolution=$1
      ;;
    -*)
      usage;;
    *)
      fig=$1
  esac
  shift
done

gif=`echo $fig | sed -e 's/\.[^\.]*$/.gif/'`

awk -f $HYPERLATEX_DIR/normalize-eps.awk $fig \
| gs -q -dNOPAUSE -r$resolution $antialiasing -sDEVICE=ppm -sOutputFile=- - \
| pnmcrop | $quantcmd | ppmtogif -interlace $transcmd > $gif

echo "Done"