added the encoding part, thought it's not working. Wondering if we should be using the getRGB() method.