[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: print.m problems: png format
From: |
Laurent Mazet |
Subject: |
Re: print.m problems: png format |
Date: |
Wed, 12 Nov 2003 17:08:57 +0100 |
On Thu, 13 Nov 2003 00:33:59 +0100
charo <address@hidden> wrote:
> Hi again,
>
> it seems that the problem is printing using png format. In this case,
> the output file is empty. Another issue is that printing with png format
> hags gnuplot and octave.
>
> I can provide more details if anybody wishes so.
> Hope this helps.
> R
>
David and I wrote a script to convert EPS to png.
-8<-
#! /bin/sh -f
RESOL="-r300"
OPTIONS=""
PNMROTATEOPTIONS=""
#PNMTRANSPARENT="-background white -transparent =white"
PNMTRANSPARENT=""
USEPNMROTATE="false"
addshowpage="/crm/fantasio/bstl/share/prog/script/ps2png.ps"
while true
do
case "$1" in
-nt) PNMTRANSPARENT="" ;;
-ccw) PNMROTATEOPTIONS="$PNMROTATEOPTIONS 90" ; USEPNMROTATE="true" ;;
-cw) PNMROTATEOPTIONS="$PNMROTATEOPTIONS -90" ; USEPNMROTATE="true" ;;
-nt) PNMTRANSPARENT="";;
-r*) OPTIONS="$OPTIONS $1" ; RESOL="" ;;
-*) OPTIONS="$OPTIONS $1" ;;
*) break ;;
esac
shift
done
# Set default resolution if the user hasn't overridden it
OPTIONS="$OPTIONS $RESOL"
if [ $# -lt 1 -o $# -gt 2 ]; then
echo "Usage: `basename $0` [options...] input.ps [output.png]" 1>&2
echo " -ccw|-cw: rotate" 1>&2
echo " -nt: no transparency" 1>&2
exit 1
fi
infile=$1;
if [ $# -eq 1 ]
then
case "${infile}" in
*.ps) base=`basename ${infile} .ps` ;;
*.eps) base=`basename ${infile} .eps` ;;
*) base=`basename ${infile}` ;;
esac
outfile=${base}.png
else
outfile=$2
fi
if [ "$(grep -L -i showpage ${infile})" != "" ]; then
infile="${infile} ${addshowpage}"
fi
# Now ghostscript it, getting rid of BoundingBox offsets at the same time
if [ "$USEPNMROTATE" == "true" ]; then
# Use PNMROTATE and not PNMFLIP as I get a seg fault with PNMFLIP.
epsffit $(grep '^%%BoundingBox:' ${infile} | head -1 | \
awk '{printf "0 0 %d %d", $4-$2, $5-$3;}') ${infile} | \
gs -q -dNOPAUSE -dBATCH -sDEVICE=pnm -sOutputFile=- $OPTIONS -f - \
-c quit | pnmcrop | pnmrotate $PNMROTATEOPTIONS | \
pnmtopng $PNMTRANSPARENT > ${outfile}
else
epsffit $(grep '^%%BoundingBox:' ${infile} | head -1 | \
awk '{printf "0 0 %d %d", $4-$2, $5-$3;}') ${infile} | \
gs -q -dNOPAUSE -dBATCH -sDEVICE=pnm -sOutputFile=- $OPTIONS -f - \
-c quit | pnmcrop | pnmtopng $PNMTRANSPARENT > ${outfile}
fi
->8-
--
Dr. Laurent Mazet: Research Engineer /V\ Centre de Recherche de MOTOROLA
Tel: +33 (0)1 69 35 48 30 =-=-=-=-=-=-=-=-=-=-= Email: address@hidden
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------