refactoring image converter