Implementation of grayscale