Add image_set_samples function