added more parameters to gen_image