Does anyone have code for loading a 24-bit bitmap from file and then converting it into an 8-bit bitmap? Also, how is this done to best minimize color loss?

Thanks