refactor imageop for extensibility