Convert Bitmap to Greyscale

How do I convert a 8 or 16-bit pixel format (color) bitmap to a greyscale
bitmap?

Stefan