Faster grayscale function from raw image