generalize creation of the image entities to a utility function
moved the creation of image entities out of imageutils and to a factory.