From albanycs!leah:rsb584 Wed Mar 23 23:48:59 1988 Received: by albanycs.albany.edu (5.54/4.8) id AA29537; Wed, 23 Mar 88 22:13:02 EST Date: Wed, 23 Mar 88 22:12:59 EST From: albanycs!leah:rsb584 (Raymond S Brand) Received: by leah.Albany.EDU (5.58/1.1) id AA02566; Wed, 23 Mar 88 22:12:59 EST Message-Id: <8803240312.AA02566@leah.Albany.EDU> To: albanycs:beowulf!rsbx Subject: 24bitcode.txt >From raveling@vaxa.isi.edu Mon Mar 14 18:35:33 1988 Path: leah!uwmcsd1!ig!agate!pasteur!ames!oliveb!felix!trwrb!aero!venera.isi.edu!raveling From: raveling@vaxa.isi.edu (Paul Raveling) Newsgroups: comp.graphics,comp.windows.x Subject: Re: Pixmap color compression (The 24-bit question.) Keywords: color, colormaps Message-ID: <5034@venera.isi.edu> Date: 14 Mar 88 23:35:33 GMT References: <927@xn.LL.MIT.EDU> <512@imagine.PAWL.RPI.EDU> Sender: news@venera.isi.edu Reply-To: raveling@vaxa.isi.edu (Paul Raveling) Organization: USC-Information Sciences Institute Lines: 60 In article <927@xn.LL.MIT.EDU> wjc@XN.LL.MIT.EDU (William J. Chiarchiaro) writes: >Does anyone know of an algorithm for doing the following: > > Take a digitized, color image composed of 24-bit pixels > (8 bits red, 8 bits green, 8 bits blue), and convert it to > an 8-bit-per-pixel color image along with a suitable > 256-entry colormap (each entry has 8 bits of red, 8 of green, > and 8 of blue). I've posted our utilities to do this sort of thing on vaxa.isi.edu, available via anonymous ftp from pub/X. Also posted are three sample pixmaps generated from the same data, using 16, 32, and 200 colors. The color allocation routine, alcols.c, attempts to produce color assignments fairly close to optimal while running reasonably fast. A 512x480 pixmap requires about 1 1/2 minutes to process on an HP 9000/350, and the sample pixmaps show good image quality even at 16 colors. I can supply the source of alcols.c by email to anyone without ftp access (If it's possible to reach you by email!). This module depends on virtually nothing and should be easily portable. Other files in the util subdirectory are various related utilities. Most use X10.4. Those most appropriate to the color compression problem are: genpix.c Program using alcols.c to generate a pixmap file from separate files of red, green, and blue pixel data viewpix.c Pixmap viewer -- displays pixmap files created by genpix, plus a magnified image of pixels around the cursor. Viewpix accepts pixmap files in either compressed or uncompressed format. Easiest way to everything is by getting: pub/X/util.tar.Z All util sources, 94,269 bytes. Generates "./util/*" when unpacked. See ./util/README and ./util/*.doc for more info. pub/X/sample_pixmaps.tar Three pixmaps showing map of South China Sea area, 348,160 bytes. This is a TAR file of compressed pixmap files, will generate "./sample_pixmaps/*" when unpacked. --------------------- Paul Raveling Raveling@vaxa.isi.edu