image: redesign Decode/Encode api.