ColorRes example for Delphi

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

If Lead1.BitmapBits <> 8 Then
begin
    Screen.Cursor := crHourglass;
    Lead1.ColorRes(8, CRF_OPTIMIZEDPALETTE, CRF_FLOYDSTEINDITHERING, 0);
    Lead1.ForceRepaint;
    Screen.Cursor := crDefault;
End;