ftp.nice.ch/pub/next/graphics/filter/PBMImageFilter.README

This is the README for PBMImageFilter.1.0.N.b.tar.gz [Download] [Browse] [Up]


PBMImageFilter
Version 1.0
By Daryll Strauss


This application is a filter service built upon the Portable BitMap toolkit by Jeff Poskanzer. Basically is uses the PBM+ tools to convert a large number of image formats into PBM formats and then uses pnmtotiff to convert the PBM format into a TIFF. The NXImage class will automatically invoke these filters to convert files and this gives you the ability to transparently open a large number of image files.

The PBMImageFilter determines the format of image file by the extension on the file name. The supported formats are:

    Sun icon file                                		.icon
    X10 and X11 bitmap file                      	.xbm
    MacPaint                                     		.macp
    CMU window manager format			.cmuwm
    MGR format                                   		.mgr
    Group 3 FAX                                  		.g3
    GEM .img format                              		.gem
    Bennet Yee's "face" format                   	.ybm
    Atari Degas .pi3 format                      	.pi3
    Andrew Toolkit raster object                 	.atk
    Xerox doodle brushes                        	.brush
    Usenix FaceSaver(tm) file                    	.fs
    FITS                                         			.fits
    Lisp Machine bit-array-file                  	.lispm
    HIPS                                        			.hips
    GIF                                    				.gif      
    IFF ILBM                                     		.iff
    PICT                                         			.pict
    Atari Degas .pi1 format                      	.pi1
    XPM (X Window System ASCII pixmaps)	.xpm
    PC Paintbrush .pcx format                    	.pcx
    TrueVision Targa file                        		.tga
    HP PaintJet format                           		.pj
    Abekas YUV format                            	.yuv
    MTV/PRT ray-tracer output                   	.mtv
    QRT ray-tracer output                       		.qrt
    Img-whatnot file                            		.img
    Xim file                                    			.xim
    Atari uncompressed Spectrum                 	.spct
    Atari compressed Spectrum                   	.sput
    AutoCAD slide format                         	.sld
    Sun raster file                              		.rast
    X10/X11 window dump file			.xwd
    Portable Bitmap Files					.pbm
    Portable Greymap Files				.pgm
    Portable Pixmap Files				.ppm
    JPEG File Interchange Format			.jpg

The PBM package has many other conversion utilities. If you want to convert from TIFF into a different format you can run tifftopnm and then one of the converters into the format you want. 

Quick Installation:

Install the package pbmtools.pkg into /usr/local/bin. Install the package PBMImageFilter into /LocalLibrary/Services. Type make_services at a shell. At this point the program should run. Try to use Preview to open an image file that is in a format listed above.

Configuration:

There is a configuration file that PBMImageFilter uses. It is called config and is stored in the directory with the Filter. The first line of the file is used to set the general configuration information. First it has the number of image types the config file contains, then it has the directory containing the PBM tools, finally it has the name of the TIFF converter. Each of these is separated by whitespace. The following lines of the file list the extension for a particular type of image and the name of the converter for that type of image. The application starts by knowing about 37 different image types, where the PBM tools live in /usr/local/bin, and uses pnmtotiff as the converter to get to tiff format. There is one "hack" to be aware of. My filter expects to be two stages, one to get into PBM format and one to convert PBM format to TIFF. If you start with a PBM format you don't need the first stage. So, I just use the application "cat" as the first stage. Since cat isn't in the PBM bin directory it is hard coded to mean /bin/cat. This shouldn't cause any harm, but don't try to make a PBM converter that's called 'cat'.

The Filter will look for the PBM tool called pnmtotiff in the workspaces path first, then the default directory that you specified. The individual user may add a dwrite 
	PBMImageFilter PathToPBM <path> 
to override this search path. Once it finds this program it assumes that all PBM converters are located in this directory.

Building and Installing:

The Makefile understands two targets all and install. Make all will build the PBMImageFilter and Make install will install it in ~/Library/Services.  If you would like to install the service more globally, the change the line:
	DSTDIR = $(HOME)/Library/Services/PBMImageFilter.service
to
	DSTDIR = /NextLibrary/Services/PBMImageFilter.service
and the filters will be available to anyone on the machine.

Adding PBM Tools:

Adding tools is very easy. 

	1) Place an application in your PBM directory that converts the new image type into one of the PBM types.
	2) Add one to the integer at the top of the config file.
	3) Add your image extension and converter to the end of the config file.
	4) Add a line to the services file that says:
		Send Type: NXFilenamePboardType:<your extension>
	Notice that you can not have more than 16 Send Types in a single service entry.
	You will need to create a new service entry (to add more)
	5) If PBMImageFilter is already running you will need to kill it.
	
Distribution:

There are three distributions to this package. 

1) PBMImageFilter.binaries.tar.Z. This includes one installer package to install the PBMImageFilter and one to install the PBM binaries. This is about 4 megs.

2) PBMImageFilter.sources.tar.Z. This includes just the source to the PBMImageFilter and not the PBM package.  This is about 22k.

3) PBM.sources.tar.Z. This includes the sources to the PBM package. This is about 4 megs.

Usage and Licensing:

    Source code I have wrriten is
    	Copyright  (C) 1993 by Daryll Strauss
    other software, such as the PBM package is copyright by its author, but has
    licensing similar to the following which is used in my source code.
	
    Permission to use, copy, modify, and distribute this software and its
    documentation for any purpose and without fee is hereby granted, provided
    that the above copyright notice appear in all copies and that both that
    copyright notice and this permission notice appear in supporting
    documentation.  This software is provided "as is" without express or
    implied warranty.

Donations/TradeWare?

    If you think this program is useful and you or your company has a piece of shareware or comercial software available, I'd appreciate it if you'd send me a copy. You are welcome to use this software as licensed above regaurdless of whether or not you donate any software.
	
Contacting Me?

If you have any questions or comments about this software, I'll do my best to answer them. Send me mail at  daryll@harlot.rb.ca.us. 

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.