Fix image encoding.