[Lazarus] Color Palette of Timage

Karl-Michael Schindler karl-michael.schindler at physik.uni-halle.de
Thu Apr 20 10:47:33 CEST 2023


I have an 8 bit grey value image without color palette in memory from a camera, which I want to display in a TImage, whereby, the color white has to be converted to red. I expected to do this by adding to the RawImage of TImage a color palette of size 256 and filling the palette with values to RGB values for grey, except the one for white, which will receive red. I tried different things, reading docs and so on, but did not manage to get this done. Could it be that palettes for not fully implemented or am I misreading the docs? Can someone give me some directions or is there an example how to modify pixels of an image by changing values in the color palette or exchanging the color palette. A second task is to replace a 8 or 16 bit grey scale palette by a specific color palette. I know exactly how the rgb values of the palette should be. I manage to do this with an TFPMemoryImage from fpimage and create png images with a TFPCustomImageWriter from fpwritepng, but failed to do the same with an TImage. I tried to assign the TFPMemoryImage to TImage, but that did not work either.

Greetings - Karl-Michael Schindler.

More information about the lazarus mailing list