to mattress :
//在设计期间加载一幅图象于Image1上
procedure TForm1.Button1Click(Sender: TObject);
var
Bmp :TBitmap;
pal
MaxLogPalette;
palEntryNum :Integer;
r,g,b :Byte;
begin
Bmp :=TBitmap.Create;
Bmp.Assign(Image1.Picture.Bitmap);
Bmp.PixelFormat :=pf8bit; //256色
SelectPalette(Bmp.Canvas.Handle,BmP.Palette,False);
RealizePalette(Bmp.Canvas.Handle);
pal.palVersion :=$0300;
pal.palNumEntries :=256;
GetMem(pal,SizeOf(TLOGPALETTE)+255*SizeOf(TPALETTEENTRY));
palEntryNum :=GetPaletteEntries(Bmp.Palette,0,255,pal.palpalEntry);
r :=pal.palpalEntry[15].peRed; //得到索引号为15对应的颜色
g :=pal.palpalEntry[15].peGreen;
b :=pal.palpalEntry[15].peBlue;
Edit1.Text :=IntToStr(r);
Edit2.Text :=IntToStr(g);
Edit3.Text :=IntToStr(b);
end;