#!/bin/sh
#
# tex-thumbnailer - Thumbnailer script for TEX (TeX/LaTeX) files.
#
# Usage: tex-thumbnailer tex-file png-file size
#

# command line parameters
ifile=$1
ofile=$2
size=$3

filesize=`du ${ifile}`

# don't try and generate thumbnails of huge files...
if [ ${filesize} -gt 30000 ]; then
    exit 1
fi

exec gracebat -hardcopy -hdevice PNG "${ifile}" -printfile - | convert - -scale "$sizex$size" "png:${ofile}"
