How to convert a color image to grayscale

Sometimes an undemosaiced Bayer raw image gets improperly saved into a BMP or TIFF format that includes color channels that are all equal. In this case, Imatest will recognize the image as color, and not give you the monochrome read options that allow you to perform demosaicing or analyze the image as a Bayer raw.

Here are a variety of ways to convert a color image to grayscale:

Imagemagick command line utility

$ convert -type Grayscale rawcolor.bmp mono.bmp

GIMP / Photoshop

Image -> Mode -> Grayscale



From Image -> Tyoe -> Select the desired output bit depth


Ctrl-G or from the image menu select Convert to Grayscale


img = imread('rawcolor.bmp');
r = img(:, :, 1);
imwrite(r, 'mono.bmp');


Read More