refactored code for image processing into the ImageProcessor class.