> For ie8p format the array should be array[0..255] of TRGB.
No - because I want the routine to select the 256 colors from an available palette of 512 colors...
> Also your for next loop only generates 3^3=27 entries all of which are very close to black.
A transcription error when trying to simplify the actual routine. Here's an update:
FUNCTION ConvertTo9bit(BMP : TBitMap) : TBitMap;
CONST
Intensity : ARRAY[0..7] OF BYTE = (0,36,73,109,146,182,219,255);
VAR
Palette : ARRAY[0..511] OF TRGB;
I : Cardinal;
R,G,B : BYTE;
BEGIN
I:=LOW(Palette);
FOR R:=0 TO 7 DO FOR G:=0 TO 7 DO FOR B:=0 TO 7 DO Palette[PostInc(I)].Initialize(Intensity[R],Intensity[G],Intensity[B]);
PROC.SetBMP(BMP);
PROC.ConvertTo(TIEPixelFormat.ie8p,Palette,TIEDitherType.iedtErrorDiffusion);
Result:=BMP
END;
As you can see (now), the palette I'm making is 512 entries, each with 8 different levels of Red, Green and Blue components. I would like the image color reduced to 256 of these 512 possible values (chosen by the ConvertTo method based on the current pixels in the image) and using dithering among these selected 256 colors to simulate the remaining 2^24-256 colors.
> https://www.imageen.com/help/TIEPaletteType.html
None of these palettes are 512 entries of variying levels of RGB, so no.