removed create_image and implemented the functionality in save_image; some refactoring