Removed the image_type import statement, because its not needed anymore. The Outputformat is now given as string from the object. Make some formal changes to the code.