Implement encoding Greyscale images