Many image processing algorithms are defined for [[wp:Grayscale|grayscale]] (or else monochromatic) images. 


;Task:
Extend the data storage type defined [[Basic_bitmap_storage|on this page]] to support grayscale images. 

Define two operations, one to convert a color image to a grayscale image and one for the backward conversion. 

To get luminance of a color use the formula recommended by [http://www.cie.co.at/index_ie.html CIE]:

 <big> L  =  0.2126 &times; R   +   0.7152 &times; G   +   0.0722 &times; B </big>

When using floating-point arithmetic make sure that rounding errors would not cause run-time problems or else distorted results when calculated luminance is stored as an unsigned integer. 
<br><br>

