Date: Fri, 09 Aug 2002 15:07:38 -0400 From: Dean Verhoeven I've been struggling for the last 2 days trying to figure out how to display B/W images in pseudocolor using Delphi. I want to be able to take an image with any range of pixel values, map those values to palette indices in the range 0-255 in a bitmap, and have that bitmap displayed according to a color map I define. I want to be able to change the color map without having to change the bitmap, and without provoking windows to change the bitmap. You gave a good example of how to display an 8-bit image with a user-defined palette on usenet. But it doesn't show how to change the image's palette without redefining the image: just assigning a new palette to the Bitmap.Palette doesn't work, one apparently has to re-write the indices to the bitmap _after_ each change of the palette to get the desired effect. This is not very efficient. The answer is the SetDIBColorTable() function, used like this: var i : integer; ColorTable : array[byte] of TRGBQuad; begin for i := 0 to 255 do with ColorTable[i] do begin rgbBlue := i; rgbGreen := i; rgbRed := i; rgbReserved := 0; end; SetDIBColorTable(Bitmap.Canvas.Handle, 0, 256, ColorTable); Invalidate; // cause Bitmap to be redrawn end; One doesn't even have to define a palette for the bitmap (TLogPalette, CreatePalette and all that): just define the pixel values of the bitmap, and then call a function like the one given above to tell Windows what colors to display for what pixel values (The Bitmap must be defined with Bitmap.HandleType := bmDIB). I got this answer from a usenet post (Fred Hovey, "Re: Changing colors in 8-bit bitmaps - The Solution"), I thought you might be interested. I also want to thank you for the information on your web site, which is very helpful. dean verheoven -- Dean Verhoeven ancona research inc.