got the image encoding working