"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "converter/ppm/hpcdtoppm/pcdovtoppm" between
netpbm-10.91.00.tar.xz and netpbm-10.91.01.tar.xz

About: Netpbm is a toolkit for conversion of images between a variety of different formats, as well as to allow a few basic image operations (a successor to Jef Poskanzer’s PBMPlus package). Latest release.

pcdovtoppm  (netpbm-10.91.00.tar.xz):pcdovtoppm  (netpbm-10.91.01.tar.xz)
#!/bin/bash #!/bin/sh
# #
# pcdovtoppm - generate a single PPM file from a PCD overview file # pcdovtoppm - generate a single PPM file from a PCD overview file
# #
# Based on pnmindex (PBMPLUS), which was written by Jef Poskanzer, # Based on pnmindex (PBMPLUS), which was written by Jef Poskanzer,
# this script makes also use of hpcdtoppm, written by Hadmut Danisch. # this script makes also use of hpcdtoppm, written by Hadmut Danisch.
# #
# Formerly called Pcdindex. # Formerly called Pcdindex.
# #
# A similar result can be achieved by using "hpcdtoppm -Overview" # A similar result can be achieved by using "hpcdtoppm -Overview"
# followed by "pnmindex -black" on the generated PPM images. # followed by "pnmindex -black" on the generated PPM images.
skipping to change at line 139 skipping to change at line 139
*) *)
break break
;; ;;
esac esac
done done
if [ $versionopt -eq 1 ] ; then if [ $versionopt -eq 1 ] ; then
version version
elif [ $# = 0 ] ; then elif [ $# -eq 0 ] ; then
usage usage
fi fi
tempdir=$(mktemp -d "${TMPDIR:-/tmp}/pcdovtoppm.XXXXXXXX") || tempdir=$(mktemp -d "${TMPDIR:-/tmp}/pcdovtoppm.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 trap 'rm -rf $tempdir' 0
tmpfile=`tempfile -p pi -m 600` tmpfile=`tempfile -p pi -m 600`
rowfiles=()
imagefiles=()
row=1
col=1
width=$size
# Convert the PCD overview file to many PPM images # Convert the PCD overview file to many PPM images
if [ -f $1 ] ; then if [ -f $1 ] ; then
hpcdtoppm -Overview $1 $tmpfile || hpcdtoppm -Overview $1 $tmpfile ||
{ echo "$0: Hpcdtoppm failed. Exiting" 1>&2 ; exit 1; } { echo "$0: Hpcdtoppm failed. Exiting" 1>&2 ; exit 1; }
else else
echo "$0 : Could not access $1" 1>&2 echo "$0 : Could not access $1" 1>&2
echo " " 1>&2 echo " " 1>&2
usage usage
fi fi
imagefiles=
rowfiles=
row=1
col=1
width=$size
for i in "$tmpfile"* for i in "$tmpfile"*
do do
if [ -f $i ] ; then if [ -f $i ] ; then
description=`pnmfile $i` thiswidth=$(pamfile -machine $i | cut -f 4 -d ' ')
if [ "${description[4]}" -le $size -a \ thisheight=$(pamfile -machine $i | cut -f 5 -d ' ')
"${description[6]}" -le $size ] ; then if [ "$thiswidth" -le $size -a "$thisheight" -le $size ] ; then
cat $i > $tmpfile cat $i > $tmpfile
else else
if [ "$colors" = "n" ] ; then if [ "$colors" = "n" ] ; then
pnmscale -quiet -xysize $size $size $i > $tmpfile pnmscale -quiet -xysize $size $size $i > $tmpfile
else else
pnmscale -quiet -xysize $size $size $i | \ pnmscale -quiet -xysize $size $size $i | \
ppmquant -quiet $colors > $tmpfile ppmquant -quiet $colors > $tmpfile
fi fi
fi fi
fi fi
imagefile=${tempdir}/pi.${row}.${col} imagefile=${tempdir}/pi.${row}.${col}
rm -f $imagefile rm -f $imagefile
skipping to change at line 194 skipping to change at line 194
if [ "$back" = "-white" ] ; then if [ "$back" = "-white" ] ; then
pbmtext $font "$ttext" | pnmcrop -quiet | pnmmargin -white 2| \ pbmtext $font "$ttext" | pnmcrop -quiet | pnmmargin -white 2| \
pnmcat $back -tb $tmpfile - > $imagefile pnmcat $back -tb $tmpfile - > $imagefile
else else
pbmtext $font "$ttext" | pnmcrop -quiet | pnmmargin -white 2 | \ pbmtext $font "$ttext" | pnmcrop -quiet | pnmmargin -white 2 | \
pnminvert | pnmcat $back -tb $tmpfile - > $imagefile pnminvert | pnmcat $back -tb $tmpfile - > $imagefile
fi fi
rm -f $tmpfile rm -f $tmpfile
description=`pnmfile $imagefile` thisWidth=$(pamfile -machine $i | cut -f 4 -d ' ')
width=$(( $width + ${description[4]} )) width=$(( $width + $thisWidth ))
imagefiles="$imagefiles $imagefile" imagefiles="$imagefiles $imagefile"
if [ $col -ge $across -o $width -gt $maxwidth ] ; then if [ $col -ge $across -o $width -gt $maxwidth ] ; then
rowfile=${tempdir}/pi.${row} rowfile=${tempdir}/pi.${row}
rm -f $rowfile rm -f $rowfile
if [ "$colors" = "n" ] ; then if [ "$colors" = "n" ] ; then
pnmcat $back -lr -jbottom $imagefiles > $rowfile pnmcat $back -lr -jbottom $imagefiles > $rowfile
else else
pnmcat $back -lr -jbottom $imagefiles | \ pnmcat $back -lr -jbottom $imagefiles | \
ppmquant -quiet $colors > $rowfile ppmquant -quiet $colors > $rowfile
fi fi
rm -f $imagefiles rm -f $imagefiles
imagefiles=() imagefiles=
rowfiles="$rowfiles $rowfile" rowfiles="$rowfiles $rowfile"
col=1 col=1
row=$(( $row + 1 )) row=$(( $row + 1 ))
width=$size width=$size
else else
col=$(( $col + 1 )) col=$(( $col + 1 ))
fi fi
done done
if [ ${#imagefiles[*]} -gt 0 ] ; then if [ -n $imagefiles ] ; then
rowfile=${tempdir}/pi.${row} rowfile=${tempdir}/pi.${row}
rm -f $rowfile rm -f $rowfile
if [ "$colors" = "n" ] ; then if [ "$colors" = "n" ] ; then
pnmcat $back -lr -jbottom $imagefiles > $rowfile pnmcat $back -lr -jbottom $imagefiles > $rowfile
else else
pnmcat $back -lr -jbottom $imagefiles | \ pnmcat $back -lr -jbottom $imagefiles | \
ppmquant -quiet $colors > $rowfile ppmquant -quiet $colors > $rowfile
fi fi
rm -f $imagefiles rm -f $imagefiles
rowfiles="$rowfiles $rowfile" rowfiles="$rowfiles $rowfile"
fi fi
if [ ${#rowfiles[*]} = 1 ] ; then if [ $(echo $rowfiles|wc -w) -eq 1 ] ; then
ppmtoppm $plainopt < $rowfiles ppmtoppm $plainopt < $rowfiles
else else
if [ "$colors" = "n" ] ; then if [ "$colors" = "n" ] ; then
pnmcat $back -tb $plainopt $rowfiles pnmcat $back -tb $plainopt $rowfiles
else else
pnmcat $back -tb $rowfiles | ppmquant $plainopt -quiet $colors pnmcat $back -tb $rowfiles | ppmquant $plainopt -quiet $colors
fi fi
fi fi
rm -f $rowfiles rm -f $rowfiles
 End of changes. 10 change blocks. 
17 lines changed or deleted 17 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)