refactor image to object