diff options
Diffstat (limited to 'converter/ppm/hpcdtoppm')
-rw-r--r-- | converter/ppm/hpcdtoppm/Makefile | 22 | ||||
-rw-r--r-- | converter/ppm/hpcdtoppm/README | 37 | ||||
-rwxr-xr-x | converter/ppm/hpcdtoppm/hpcdtoppm | 18 | ||||
-rwxr-xr-x | converter/ppm/hpcdtoppm/pcdovtoppm | 172 |
4 files changed, 152 insertions, 97 deletions
diff --git a/converter/ppm/hpcdtoppm/Makefile b/converter/ppm/hpcdtoppm/Makefile index 5777a84f..9633017e 100644 --- a/converter/ppm/hpcdtoppm/Makefile +++ b/converter/ppm/hpcdtoppm/Makefile @@ -7,11 +7,29 @@ VPATH=.:$(SRCDIR)/$(SUBDIR) include $(BUILDDIR)/config.mk -all: hpcdtoppm +SCRIPTS = pcdovtoppm + +ifeq ($(file <hpcdtoppm-import/Makefile)x,x) + # The file does not exist, which means user did not augment the + # Netpbm source tree by adding hpcdtoppm source code. + # + # Therefore, we package the dummy 'hpcdtoppm' program that just tells the + # user how to get the real one. + # + # See README in this directory. + # + # (Note that empty file and nonexistent file look the same with + # $(file)). + SCRIPTS += hpcdtoppm +else + SUBDIRS += hpcdtoppm-import +endif -SCRIPTS = hpcdtoppm pcdovtoppm MERGE_OBJECTS = +.PHONY: all +all: $(BINARIES) $(SUBDIRS:%=%/all) + include $(SRCDIR)/common.mk install.bin install.merge: install.bin.local diff --git a/converter/ppm/hpcdtoppm/README b/converter/ppm/hpcdtoppm/README index a1c7c8c2..ec23ec1b 100644 --- a/converter/ppm/hpcdtoppm/README +++ b/converter/ppm/hpcdtoppm/README @@ -1,20 +1,25 @@ -This 'hpcdtoppm' directory is really just a placeholder for the real -Hpcdtoppm source code. +The 'hpcdtoppm' code in this directory is just a dummy version of the program +that tells you where to get the real code. -The real Hpcdtoppm source code cannot be distributed on Sourceforge -because a copyright holder does not license it in a way open enough to -meet Sourceforge's requirements. +The real "hpcdtoppm' source code cannot be distributed on Sourceforge because +a copyright holder does not license it in a way open enough to meet +Sourceforge's requirements. -Therefore, the Netpbm maintainer distributes Hpcdtoppm via another channel -and distributes this dummy directory in the main Netpbm source tree on -Sourceforge. When you run the program named 'hpcdtoppm' in this directory, -it tells you how to get the real Hpcdtoppm. +Therefore, the Netpbm maintainer distributes 'hpcdtoppm' via another channel +and distributes this dummy directory in the main Netpbm source tree on +Sourceforge. -When you get the real Hpcdtoppm tarball, just unpack it and replace -this entire 'hpcdtoppm' directory with its contents. Then build -Netpbm normally. +The code is at + + http://ibiblio.org/pub/Linux/apps/graphics/convert/hpcdtoppm-netpbm.tgz + +When you get the real 'hpcdtoppm' tarball, just unpack its contents into the +'hpcdtoppm-import' subdirectory. Then build Netpbm normally. The build +detects the presence of the code and builds and packages the real 'hpcdtoppm' +program instead of the dummy one. + +Bear in mind when you get the real 'hpcdtoppm' that it is not as openly +licensed as what's in the rest of the Netpbm source tree. As you'll see in +the license that comes with 'hpcdtoppm', you may _not_ sell it to someone +else.) -Bear in mind when you get the real Hpcdtoppm, that it is not as openly -licensed as what's in the rest of the Netpbm source tree. As you'll -see in the license that comes with Hpcdtoppm, you may _not_ sell it to -someone else.) diff --git a/converter/ppm/hpcdtoppm/hpcdtoppm b/converter/ppm/hpcdtoppm/hpcdtoppm index 2af4a384..2a61aa9d 100755 --- a/converter/ppm/hpcdtoppm/hpcdtoppm +++ b/converter/ppm/hpcdtoppm/hpcdtoppm @@ -8,18 +8,16 @@ The real 'hpcdtoppm' is a program that converts an image from Photo CD format to PPM format. The program you are running now just issues the message you are reading. -Please get a copy of Hpcdtoppm from - - http://terasaur.org/item/show/hpcdtoppm-netpbm-convert-photo-cd/4967 - -and replace this stand-in program with the real one. +Instructions for getting the 'hpcdtoppm' source code and building it into +Netpbm are in the file converter/ppm/hpcdtoppm/README in the distributed +Netpbm source tree. The point of this is that this stand-in 'hpcdtoppm' is distributed with Netpbm -on Sourceforge. Hpcdtoppm does not meet the requirements to be distributed on -Sourceforge because a copyright holder does not permit people to sell copies. -At one time, the real Hpcdtoppm was distributed with Netpbm on Sourceforge by -mistake. +on Sourceforge. 'hpcdtoppm' does not meet the requirements to be distributed +on Sourceforge because a copyright holder does not permit people to sell +copies. At one time, the real 'hpcdtoppm' was distributed with Netpbm on +Sourceforge by mistake. EOF -exit 1 \ No newline at end of file +exit 1 diff --git a/converter/ppm/hpcdtoppm/pcdovtoppm b/converter/ppm/hpcdtoppm/pcdovtoppm index 01a68313..2a875690 100755 --- a/converter/ppm/hpcdtoppm/pcdovtoppm +++ b/converter/ppm/hpcdtoppm/pcdovtoppm @@ -19,12 +19,16 @@ # Rewritten in sh by Steve McIntyre <93sam@debian.org>, 2001 # You may want to change the default values in the next 6 lines: -maxwidth=1152 # maximum width of the index image -size=192 # make the images about this big -across=6 # show this many images per row -colors="noquant" # maximum amount of colors or noquant (no quantization) -back="-black" # default background color -font=" " # default font or none (pbmtext's internal font) +maxwidth=1152 # maximum width of the index image +size=192 # make the images about this big +across=6 # show this many images per row +colors="noquant" # maximum amount of colors or noquant (no quantization) +back="-black" # default background color +font=" " # default font or none (pbmtext's internal font) + +plainopt="" # output plain ppm +quietopt="" # quiet operation (currently no effect) +versionopt=0 usage () { @@ -47,79 +51,108 @@ usage () exit 1 } +version () +{ + # report version using pnmscale + pnmscale -version $quietopt + exit 0 +} + # Parse the options while :; do case "$1" in - -m*) + -m|-ma|-max|-maxw|-maxwi|-maxwid|-maxwidt|-maxwidth ) if [ $# -lt 2 ] ; then usage; fi maxwidth="$2" shift shift ;; - -s*) + -s|-si|-siz|-size ) if [ $# -lt 2 ] ; then usage; fi size="$2" shift shift ;; - -a*) - if [ $# -lt 2 ] ; then usage; fi - across="$2" - shift - shift - ;; - - -c*) - if [ $# -lt 2 ] ; then usage; fi - colors="$2" - shift - shift - ;; - - -f*) - if [ $# -lt 2 ] ; then usage; fi - font="-font $2" - shift - shift - ;; - - -b*) - back="-black" - shift - ;; - - -w*) - back="-white" - shift - ;; - - -*) - echo "$0 : Unknown option $1" - echo " " - usage - ;; - - *) - break - ;; + -a|-ac|-acr|-acro|-acros|-across ) + if [ $# -lt 2 ] ; then usage; fi + across="$2" + shift + shift + ;; + + -c|-co|-col|-colo|-color|-colors ) + if [ $# -lt 2 ] ; then usage; fi + colors="$2" + shift + shift + ;; + + -f|-fo|-fon|-font ) + if [ $# -lt 2 ] ; then usage; fi + font="-font $2" + shift + shift + ;; + + -b|-bl|-bla|-blac|-black ) + back="-black" + shift + ;; + + -w|-wh|-whi|-whit|-white ) + back="-white" + shift + ;; + + -p|-pl|-pla|-plai|-plain ) + plainopt="-plain" + shift + ;; + + -q|-qu|-qui|-quie|-quiet ) + quietopt="-quiet" + shift + ;; + + -v|-ve|-ver|-vers|-versi|-versio|-version ) + versionopt="1" + shift + ;; + + -*) + echo "$0 : Unknown option $1" 1>&2 + echo " " 1>&2 + usage + ;; + + *) + break + ;; esac done -if [ $# = 0 ]; then +if [ $versionopt -eq 1 ] ; then + version +elif [ $# -eq 0 ] ; then usage fi -tmpfile=`tempfile -p pi -m 600` +tempdir=$(mktemp -d "${TMPDIR:-/tmp}/pcdovtoppm.XXXXXXXX") || + { echo "Could not create temporary file. Exiting." 1>&2; exit 1; } +trap 'rm -rf $tempdir' 0 + +tmpfile=$(mktemp --tmpdir piXXXXXX) # Convert the PCD overview file to many PPM images if [ -f $1 ] ; then - hpcdtoppm -Overview $1 $tmpfile + hpcdtoppm -Overview $1 $tmpfile || + { echo "$0: Hpcdtoppm failed. Exiting" 1>&2 ; exit 1; } else - echo "$0 : Could not access $1" - echo " " + echo "$0 : Could not access $1" 1>&2 + echo " " 1>&2 usage fi @@ -145,16 +178,17 @@ do fi fi fi - imagefile=pi.${row}.${col}.$$ + imagefile=${tempdir}/pi.${row}.${col} rm -f $imagefile ttext="$i:t" if [ "$back" = "-white" ] ; then - pbmtext $font "$ttext" | pnmcrop -quiet | pnmmargin -white 2| \ - pnmcat $back -tb $tmpfile - > $imagefile + pbmtext $font "$ttext" | pnmcrop -quiet | pnmmargin -white 2 | \ + pamcat $back -topbottom $tmpfile - > $imagefile else pbmtext $font "$ttext" | pnmcrop -quiet | pnmmargin -white 2 | \ - pnminvert | pnmcat $back -tb $tmpfile - > $imagefile + pnminvert | \ + pamcat $back -topbottom $tmpfile - > $imagefile fi rm -f $tmpfile @@ -163,12 +197,12 @@ do imagefiles="$imagefiles $imagefile" if [ $col -ge $across -o $width -gt $maxwidth ] ; then - rowfile=pi.${row}.$$ + rowfile=${tempdir}/pi.${row} rm -f $rowfile if [ "$colors" = "n" ] ; then - pnmcat $back -lr -jbottom $imagefiles > $rowfile + pamcat $back -leftright -jbottom $imagefiles > $rowfile else - pnmcat $back -lr -jbottom $imagefiles | \ + pamcat $back -leftright -jbottom $imagefiles | \ ppmquant -quiet $colors > $rowfile fi rm -f $imagefiles @@ -183,25 +217,27 @@ do done if [ -n $imagefiles ] ; then - rowfile=pi.${row}.$$ + rowfile=${tempdir}/pi.${row} rm -f $rowfile if [ "$colors" = "n" ] ; then - pnmcat $back -lr -jbottom $imagefiles > $rowfile + pamcat $back -leftright -jbottom $imagefiles > $rowfile else - pnmcat $back -lr -jbottom $imagefiles | \ - ppmquant -quiet $colors > $rowfile + pamcat $back -leftright -jbottom $imagefiles | \ + ppmquant -quiet $colors > $rowfile fi rm -f $imagefiles rowfiles="$rowfiles $rowfile" fi if [ $(echo $rowfiles|wc -w) -eq 1 ] ; then - cat $rowfiles + ppmtoppm $plainopt < $rowfiles else if [ "$colors" = "n" ] ; then - pnmcat $back -tb $rowfiles + pamcat $back -topbottom $rowfiles | \ + ppmtoppm $plainopt else - pnmcat $back -tb $rowfiles | ppmquant -quiet $colors + pamcat $back -tb $rowfiles | \ + ppmquant $plainopt -quiet $colors fi fi @@ -210,5 +246,3 @@ rm -f $rowfiles exit 0 - - |