diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2020-08-29 04:29:01 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2020-08-29 04:29:01 +0000 |
commit | 54191112065200f118588896c756ed48d99a515e (patch) | |
tree | 8dc74b7bd24e6dc053d0bc320dc07c18a18825f2 /converter | |
parent | c227dbc080d862b734f5f220345746fc8d8146bf (diff) | |
download | netpbm-mirror-54191112065200f118588896c756ed48d99a515e.tar.gz netpbm-mirror-54191112065200f118588896c756ed48d99a515e.tar.xz netpbm-mirror-54191112065200f118588896c756ed48d99a515e.zip |
Release 10.86.16
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@3933 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter')
-rwxr-xr-x | converter/other/anytopnm | 2 | ||||
-rwxr-xr-x | converter/ppm/hpcdtoppm/pcdovtoppm | 30 |
2 files changed, 16 insertions, 16 deletions
diff --git a/converter/other/anytopnm b/converter/other/anytopnm index 5409bccd..94838556 100755 --- a/converter/other/anytopnm +++ b/converter/other/anytopnm @@ -538,7 +538,7 @@ else fi tempdir=$(mktemp -d "${TMPDIR:-/tmp}/anytopnm.XXXXXXXX") || - ( echo "Could not create temporary file. Exiting." 1>&2; exit 1; ) + { echo "Could not create temporary file. Exiting." 1>&2; exit 1; } trap 'rm -rf $tempdir' 0 # Take out all spaces diff --git a/converter/ppm/hpcdtoppm/pcdovtoppm b/converter/ppm/hpcdtoppm/pcdovtoppm index dbf6f53d..01a68313 100755 --- a/converter/ppm/hpcdtoppm/pcdovtoppm +++ b/converter/ppm/hpcdtoppm/pcdovtoppm @@ -114,12 +114,6 @@ fi tmpfile=`tempfile -p pi -m 600` -rowfiles=() -imagefiles=() -row=1 -col=1 -width=$size - # Convert the PCD overview file to many PPM images if [ -f $1 ] ; then hpcdtoppm -Overview $1 $tmpfile @@ -129,14 +123,20 @@ else usage fi +imagefiles= +rowfiles= +row=1 +col=1 +width=$size + for i in "$tmpfile"* do if [ -f $i ] ; then - description=`pnmfile $i` - if [ "${description[4]}" -le $size -a \ - "${description[6]}" -le $size ] ; then + thiswidth=$(pamfile -machine $i | cut -f 4 -d ' ') + thisheight=$(pamfile -machine $i | cut -f 5 -d ' ') + if [ "$thiswidth" -le $size -a "$thisheight" -le $size ] ; then cat $i > $tmpfile - else + else if [ "$colors" = "n" ] ; then pnmscale -quiet -xysize $size $size $i > $tmpfile else @@ -158,8 +158,8 @@ do fi rm -f $tmpfile - description=`pnmfile $imagefile` - width=$(( $width + ${description[4]} )) + thisWidth=$(pamfile -machine $i | cut -f 4 -d ' ') + width=$(( $width + $thisWidth )) imagefiles="$imagefiles $imagefile" if [ $col -ge $across -o $width -gt $maxwidth ] ; then @@ -172,7 +172,7 @@ do ppmquant -quiet $colors > $rowfile fi rm -f $imagefiles - imagefiles=() + imagefiles= rowfiles="$rowfiles $rowfile" col=1 row=$(( $row + 1 )) @@ -182,7 +182,7 @@ do fi done -if [ ${#imagefiles[*]} -gt 0 ] ; then +if [ -n $imagefiles ] ; then rowfile=pi.${row}.$$ rm -f $rowfile if [ "$colors" = "n" ] ; then @@ -195,7 +195,7 @@ if [ ${#imagefiles[*]} -gt 0 ] ; then rowfiles="$rowfiles $rowfile" fi -if [ ${#rowfiles[*]} = 1 ]; then +if [ $(echo $rowfiles|wc -w) -eq 1 ] ; then cat $rowfiles else if [ "$colors" = "n" ] ; then |