/usr/bin/imagen is in hevea 2.18-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | #! /bin/sh
LATEX=latex
DVIPS=dvips
GS=gs
COM=/tmp/imagen-com.$$
RESOLUTION=100 # resolution in dpi
CROP="-trim +repage "
EXTRA=" "
MARGIN="-bordercolor none -border 2 "
TOGIF="-background white -flatten -interlace Plane gif:-"
TOPNG="-interlace Plane -quality 90 png:-"
TOEXT=${TOPNG}
EXT=png
TODIR="."
RM="/bin/rm -f"
while true
do
case $1 in
-todir)
shift
TODIR="$1"
mkdir -p ${TODIR} 2> /dev/null || :
;;
-gif)
TOEXT=${TOGIF}
EXT=gif
;;
-png)
TOEXT=${TOPNG}
EXT=png
;;
-pnm)
TOEXT="pnm:-"
EXT=pnm
;;
-quant)
shift
echo "Warning: option -quant deprecated" 1>&2
;;
-extra)
shift
EXTRA="$1"
;;
-mag)
shift
RESOLUTION="$( expr '(' "$1" '*' 100 '+' 999 ')' '/' 1000)"
;;
-res)
shift
RESOLUTION="$1"
;;
-t)
shift
TPAPER="-t $1"
;;
-pdflatex|-pdf)
LATEX=pdflatex
DVIPS=cat
;;
-raw)
EXTRA=''
MARGIN=''
TOEXT="pnm:-"
;;
*)
break
;;
esac
shift
done
echo "RESOLUTION: $RESOLUTION"
case $1 in
'')
BASE=image
;;
*)
BASE=$1
;;
esac
NAME=${BASE}.image
trap "${RM} ${NAME}.dvi ${NAME}.pdf `basename ${NAME}.log` `basename ${NAME}.aux` head.tmp body.tmp ${COM} ; exit 2" 1 2 3 8 10 13 15
DVIPSOPTS="-Z $TPAPER"
GSOPTS="-q -dNOPAUSE -dBATCH -dNOPROMPT -sDEVICE=pngalpha \
-r$RESOLUTION -dAutoRotatePages=/None \
-dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dDOINTERPOLATE \
-P- -dSAFER"
CONVERT="convert png:- ${CROP} ${EXTRA} ${MARGIN} ${TOEXT}"
echo ${CONVERT} > ${COM}
if [ "${TODIR}" = "." ]
then
FINAL=${BASE}%03d.${EXT}
else
FINAL=${TODIR}/${BASE}%03d.${EXT}
fi
test -f ${NAME}.tex ||\
{ echo "Failure: no ${NAME}.tex file!" 2>&1 ; exit 2 ; }
${LATEX} ${NAME}.tex
NAMEDIR=`dirname ${NAME}`
if [ "${LATEX}" = "pdflatex" ]
then
if [ ${NAMEDIR} != "." ]
then
mv `basename ${NAME}.pdf` ${NAME}.pdf
fi
cat ${NAME}.pdf
else
if [ ${NAMEDIR} != "." ]
then
mv `basename ${NAME}.dvi` ${NAME}.dvi
fi
${DVIPS} ${DVIPSOPTS} -o - ${NAME}.dvi
fi |\
${GS} ${GSOPTS} -sOutputFile="| sh ${COM} > ${FINAL}" -
${RM} ${COM} ${NAME}.dvi ${NAME}.pdf head.tmp body.tmp
${RM} `basename ${NAME}.log` `basename ${NAME}.aux`
|