[new uImage] Optimize gen_get_image() flow control