[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: |
Fri, 14 Nov 2003 00:15:33 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030630 |
Laurent, David,
I tested the new script, but it seems the older worked better, at least
to me.
1) The new script doesn't use the outFile name and I got a .png file
that is the output.
2) Permission is denied because yaveras.eps is readable by everyone.
3) I don't know where the second eps|ps file will be piped .
Below you can see my outputs. Probably I'm using it wrongly.
Hope I've been clear, regards,
Rosario
address@hidden scripts]$ ./eps2png yaveras.eps
./eps2png: line 58: ./yaveras.eps: Permission denied
Processing yaveras.eps -> .png:Usage: time [-apvV] [-f format] [-o file]
[--append] [--verbose]
[--portability] [--format=format] [--output=file] [--version]
[--quiet] [--help] command [arg...]
done
address@hidden scripts]$ ls -la
total 140
drwxr-xr-x 2 rbalboa rbalboa 4096 Nov 13 23:55 ./
drwxr-xr-x 85 rbalboa rbalboa 16384 Nov 13 23:59 ../
-rwxr--r-- 1 rbalboa rbalboa 3319 Nov 13 23:55 eps2png*
-rwxr--r-- 1 rbalboa rbalboa 2054 Nov 13 18:02 eps2pngOLD*
-rw-r--r-- 1 rbalboa rbalboa 29546 Nov 14 00:02 .png<-------------?
-rw-r--r-- 1 rbalboa rbalboa 2610 Nov 13 18:04 ps2png.ps
-rw-r--r-- 1 rbalboa rbalboa 43009 Nov 13 18:07 yaveras.eps
-rw-r--r-- 1 rbalboa rbalboa 29518 Nov 13 18:09 yaveras.png
address@hidden scripts]$./eps2png yaveras.eps test.png
./eps2png: line 58: ./yaveras.eps: Permission denied
Processing yaveras.eps -> .png:Usage: time [-apvV] [-f format] [-o file]
[--append] [--verbose]
[--portability] [--format=format] [--output=file] [--version]
[--quiet] [--help] command [arg...]
done
./eps2png: line 59: test.png: command not found
Skipping "test.png" (file not found)...
address@hidden scripts]$ ls
eps2png* eps2pngOLD* ps2png.ps yaveras.eps yaveras.png
address@hidden scripts]$ ls -la
total 140
drwxr-xr-x 2 rbalboa rbalboa 4096 Nov 13 23:55 ./
drwxr-xr-x 85 rbalboa rbalboa 16384 Nov 13 23:59 ../
-rwxr--r-- 1 rbalboa rbalboa 3319 Nov 13 23:55 eps2png*
-rwxr--r-- 1 rbalboa rbalboa 2054 Nov 13 18:02 eps2pngOLD*
-rw-r--r-- 1 rbalboa rbalboa 29546 Nov 14 00:08 .png
-rw-r--r-- 1 rbalboa rbalboa 2610 Nov 13 18:04 ps2png.ps
-rw-r--r-- 1 rbalboa rbalboa 43009 Nov 13 18:07 yaveras.eps
-rw-r--r-- 1 rbalboa rbalboa 29518 Nov 13 18:09 yaveras.png
where is test.png?
address@hidden scripts]$ ./eps2png yaveras.eps --output=test.png
./eps2png: line 58: ./yaveras.eps: Permission denied
Processing yaveras.eps -> .png:Usage: time [-apvV] [-f format] [-o file]
[--append] [--verbose]
[--portability] [--format=format] [--output=file] [--version]
[--quiet] [--help] command [arg...]
ESP Ghostscript 7.05.6: Unrecoverable error, exit code 1
pnmcrop: bad magic number - not a ppm, pgm, or pbm file
./eps2png: line 106: 25703 Broken pipe cat ${infile}
pnmtopng: EOF / read error reading magic number
done
address@hidden scripts]$ ls
eps2png* eps2pngOLD* ps2png.ps yaveras.eps yaveras.png
Laurent Mazet wrote:
Well,
This morning, with David, we check the script and update it. No more need of the
additional ps file and some new options having been added. You can use pnmflit
instead of pnmrotate (which is slower because it interpolates points when
rotating) and process multiple files. The help message has also been rewritten.
Laurent and David
-8<-
#! /bin/sh -f
VERSION=$(echo '$Revision: 1.9 $' | sed 's/.*\([0-9]\.[0-9.]*\).*/\1/')
RESOL="-r300"
OPTIONS=""
PNMROTATEOPTIONS=""
PNMTRANSPARENT="-background white -transparent =white"
ROTATE="false"
USEPNMFLIP="false"
help=no
addshowpage=""
list=""
trap "exit 1;" 0 1 2 15
while [ $# -gt 0 ]; do
case "$1" in
-ccw) PNMROTATEOPTIONS="90"; PNMFLIPOPTIONS="-ccw" ; ROTATE="true" ;;
-cw) PNMROTATEOPTIONS="-90"; PNMFLIPOPTIONS="-cw" ; ROTATE="true" ;;
-h) help="yes" ;;
-nt) PNMTRANSPARENT="";;
-r*) RESOL="$1" ;;
-r) shift; RESOL="-r$1" ;;
-v) echo "$(basename $0) version $VERSION" >&2; exit 1; ;;
-*) OPTIONS="$OPTIONS $1" ;;
*) list="$list $1" ;;
esac
shift
done
# Set resolution
OPTIONS="$OPTIONS $RESOL"
[ \( -z "$list" \) -o \( "$help" = yes \) ] &&
{ echo "Usage: `basename $0` [-ccw|-cw] [-h] [-rNN] [-v] [-*] <file.eps>...
-ccw: rotate counter clockwise
-cw: rotate clockwise
-h: help message
-nt: no transparency [default transparency]
-rNN: resolution (ex: \"-r75\" for 75 dpi) [default 300 dpi]
-v: show version.
-*: all others options passed to ghostscript
<file1.eps> <file2.eps>... figure's name
generate the PNG file <file>.png from Postscript or EPS file.
" >&2; exit 1; }
for infile in $list; do
# Create output file name
case "${infile}" in
*.ps) base=`basename ${infile} .ps` ;;
*.eps) base=`basename ${infile} .eps` ;;
*) base=`basename ${infile}` ;;
esac
outfile=${base}.png
[ ! -f $infile ] &&
{ echo "Skipping \"$infile\" (file not found)..." >&2; continue; }
head -1 "$infile" | grep -q "^%!" ||
{ echo "Skipping \"$infile\" (not a Postsctipt file)..." >&2; continue; }
echo -n "Processing ${infile} -> ${outfile}:"
[ "$(grep -L -i showpage ${infile})" != "" ] && \
addshowpage="%!\nshowpage\n";
# Now ghostscript it, getting rid of BoundingBox offsets at the same time
if [ "$ROTATE" == "true" ]; then
if [ "$USEPNMFLIP" == "true" ]; then
# Use PNMFLIP
( cat ${infile} ; echo -e ${addshowpage} ) | \
epsffit $(grep '^%%BoundingBox:' ${infile} | head -1 | \
awk '{printf "0 0 %d %d", $4-$2, $5-$3;}') | \
gs -q -dNOPAUSE -dBATCH -sDEVICE=pnm -sOutputFile=- $OPTIONS -f - \
-c quit | pnmcrop | pnmflip $PNMFLIPOPTIONS | \
pnmtopng $PNMTRANSPARENT > ${outfile}
else
# Use PNMROTATE and not PNMFLIP as I get a seg fault with PNMFLIP.
( cat ${infile} ; echo -e ${addshowpage} ) | \
epsffit $(grep '^%%BoundingBox:' ${infile} | head -1 | \
awk '{printf "0 0 %d %d", $4-$2, $5-$3;}') | \
gs -q -dNOPAUSE -dBATCH -sDEVICE=pnm -sOutputFile=- $OPTIONS -f - \
-c quit | pnmcrop | pnmrotate $PNMROTATEOPTIONS | \
pnmtopng $PNMTRANSPARENT > ${outfile}
fi
else
( cat ${infile} ; echo -e ${addshowpage} ) | \
epsffit $(grep '^%%BoundingBox:' ${infile} | head -1 | \
awk '{printf "0 0 %d %d", $4-$2, $5-$3;}') | \
gs -q -dNOPAUSE -dBATCH -sDEVICE=pnm -sOutputFile=- $OPTIONS -f - \
-c quit | pnmcrop | pnmtopng $PNMTRANSPARENT > ${outfile}
fi
echo " done"
done
->8-
-------------------------------------------------------------
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
-------------------------------------------------------------