help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: print.m problems: png format


From: charo
Subject: Re: print.m problems: png format
Date: Thu, 13 Nov 2003 19:06:11 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030630

Hi,

I just tested the converter from ps|eps to png. It worked fine.
Command:
        ./eps2png filein.eps fileout.png
Include ps2png.ps and change the directory where it is in the script

Thanks to David and Laurent,
Rosario



David Bateman wrote:
Laurent,

You forgot to include the file "ps2png.ps", for the case where the PS
file doesn't have a showpage in it.....

D.

According to Laurent Mazet <address@hidden> (on 11/12/03):

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
-------------------------------------------------------------






-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]