Move generate_image to base