Save example for Delphi

This example determines whether a bitmap is grayscale, saves it appropriately, loads the new file, and redisplays the bitmap.

Screen.Cursor := crHourglass; {Hourglass}

If Lead1.IsGrayscale = GRAY_NO Then
    Lead1.Save('C:\lead\IMAGES\TMP.CMP', FILE_CMP, 24, PQ2, SAVE_OVERWRITE)
Else
    Lead1.Save('C:\lead\IMAGES\TMP.CMP', FILE_CMP,8, PQ2, SAVE_OVERWRITE);

Lead1.Load('C:\lead\IMAGES\TMP.CMP', 0, 0, 1);
Lead1.ForceRepaint;
Screen.Cursor := crDefault;