Converts an RGB image to grayscale