Take an RGB buffer with specified depth and turn it into a grayscale one