Path: utzoo!attcan!uunet!lll-winken!ames!xanth!nic.MR.NET!shamash!com50!midgard!dal From: dal@midgard.Midgard.MN.ORG (Dale Schumacher) Newsgroups: comp.graphics Subject: Extending PBM to handle Greyscale and Color images Summary: I have a library nearly ready to release Message-ID: <589@midgard.Midgard.MN.ORG> Date: 17 Jan 89 21:50:49 GMT Reply-To: dal@syntel.UUCP (Dale Schumacher) Organization: The Midgard Realm, St Paul MN Lines: 61 In article <10354@well.UUCP> Jef Poskanzer writes: |I get a lot of mail about my portable bitmap toolkit. I mean a *lot* |of mail - I'm approaching 1000 messages. A certain percentage of the |mail has always asked how come the package barfs when fed a color |image. Now, I named the package specifically to avoid this class of |questions. I thought *everyone* knew that a bitmap is one bit deep. |Apparently not. [...rest of article deleted...] I took a good look at the PBM (Portable Bitmap) toolkit code that was posted recently in comp.source.misc (I think) by Mr. Poskanzer. There is quite a bit of useful code in that package. However, my first reaction was "This is great, and very portable, but it only handles 1-bit deep images (also know as bitmaps)". Being of the hacker mentality, I set out to rectify this situation, and in the process located several problems with portability in the original routines. At this point I have an entirely rewritten set of routines that handles an image file format that I'm calling PXM (Portable Pixmap), which is a superset of PBMs. PXM format stores images in one of 4 types, Monochrome Bitmaps (1 bpp), Greyscale Pixmaps (2-8 bpp), Colormapped Images (1-16 bpp, w/ 24-bit RGB colormap), or Full Color Images (24-bit RGB). Each of these image types can be stored using one of 3 storage methods, ASCII (an ASCII 1-bit image is the same as an ASCII PBM), Binary (8-bit data stream), or Binary Run-Length Encoded (8-bit data stream with RLE compression). I should mention that my RLE is *NOT* compatible with compressed PBMs. There are 4 classes of code that will be included in the PXM package. First, there is the library, a collection of C functions and a header file for routines which read/write/manage images in PXM format. The source for this part of the package is quite small (~25K) and could easily be posted to this newsgroup. Secondly, there are import/export programs which convert between PXM format and other image file formats. Third, there are system independent image processing utilities that work on PXM files, and finally, utilities (such as histograms and PXM display programs) which must be written specifically for each machine. Only the RLE code remains to be done for the library to be ready. Would it be appropriate to post it here? Only a few of the import/export programs are ready (the ones I needed, some of which were not in the PBM package), though it should be fairly easy to convert the PBM code to use the PXM library. Most of my effort is going into the generic image processing programs, many of which were not in the PBM package. There is Floyd-Steinberg dithering, generalized convolution, input/output function transformation (which can do gamma correction, positive/negative inversion, contrast enhancements, quantization, and more), and I'm hoping to have 2-d FFT processing soon. The system dependent programs are a bit of a problem. A good histogram display is needed to be able to use input/output transformation effectively, as well as an interactive graphical curve creation program, but such programs are difficult, or impossible, to write machine independently. Should machine dependent versions be posted as a basis for porting? At this point my plan is to post just the library routines here, and later to post the entire package to comp.sources.misc. Hopefully all you other graphics hackers will take the PXM routines and use them to implement your latest and greatest image processing algorithms so we can all see how well they work. PS. Jef, I tried to send you mail but it bounced, please try to reach me , or