ColorRes example for Delphi

This example checks to see if the bitmap is 8 bits per pixel and converts it if it is not.

var
   sRet: Smallint;
   RasterProc: LEADRasterProcess;
begin
   RasterProc:= CreateComObject (CLASS_LEADRasterProcess ) as LEADRasterProcess;
   If LEADRasterView1.Raster.BitmapBits <> 8 Then
   begin
      Cursor:= crHourglass;
       RasterProc.ColorRes (LEADRasterView1.Raster, 8, CRP_OPTIMIZEDPALETTE, CRD_FLOYDSTEINDITHERING, 0);
       LEADRasterView1.ForceRepaint (sRet);
       Cursor:= crDefault;
   end;
end;