Refactoring the image operations into an injected service.