implementation of image_generator. Qiu