DIBQuant 1.0 ============ DIBQuant is a dll that performs color quantization on 24-bit Device Independent Bitmaps. You can choose from several palette generation and dithering methods. DIBQuant is being distributed as freeware, use it without restriction. The interface is one function call: LPSTR FAR PASCAL QuantizeDIB(LPSTR lpDIB, int nPalette, int nDither, FARPROC lpStatus); lpDIB is a pointer to a 24 bit DIB. nPalette specifies the method to be used to generated the palette. Valid values are: #define IDX_MEDIAN 0 /* perform median cut */ #define IDX_POPULARITY 1 /* perform popularity sort */ #define IDX_DEFAULT 2 /* use default palette */ nDither specifies the dithering method to use. Valid values are: #define IDX_NONE 0 /* no dither */ #define IDX_ORDERED 1 /* ordered dither */ #define IDX_JITTER 2 /* jitter preprocessing */ lpStatus is a pointer to a function used to update the status of the operation. DIBQuant calls it to update progress. It's useful for large images that may take a while to process. It can be NULL if you don't want DIBQuant to update the status. The call must have the format: void FAR PASCAL UpdateStatus(LPCSTR lpString) { ... whatever... } You'll need to do something like this... FARPROC lpStatus = MakeProcInstance(UpdateStatus,hInstace); QuantizeDIB(lpDIB,nPalette,nDither,lpStatus); FreeProcInstance(lpStatus); QuantizeDIB returns a pointer to an quantized, 8-bit version of the original DIB. It was allocated with GlobalAllocPtr. NULL is returned if something goes wrong. That's all there is to it. Feel free to send me feedback. You're welcome to use it in your program and distribute it far and wide provided the original copyright notices are attached. If you distribute the archive file please include all of the original files. Finally, the code to perform the median cut algorithm is based upon code I found on the network. No names or copyright notices were attached, so I assume there isn't a problem using it. If anyone knows who it belongs to please let me know. Eddie McCreary June 17, 1994 edm@twisto.compaq.com