ray.data.Dataset.write_images#

Dataset.write_images(path: str, column: str, file_format: str = 'png', *, filesystem: Optional[pyarrow.fs.FileSystem] = None, try_create_dir: bool = True, arrow_open_stream_args: Optional[Dict[str, Any]] = None, ray_remote_args: Dict[str, Any] = None) None[source]#

Writes the Dataset to images.

Note

This operation will trigger execution of the lazy transformations performed on this dataset.

Examples

>>> import ray
>>> ds = ray.data.read_images("s3://anonymous@ray-example-data/image-datasets/simple")
>>> ds.write_images("local:///tmp/images", column="image")

Time complexity: O(dataset size / parallelism)

Parameters
  • path – The path to the destination root directory, where the images are written to.

  • column – The column containing the data you want to write to images.

  • file_format – The image file format to write with. For available options, see Image file formats.

  • filesystem – The pyarrow filesystem implementation to write to. These filesystems are specified in the pyarrow docs. Specify this if you need to provide specific configurations to the filesystem. By default, the filesystem is automatically selected based on the scheme of the paths. For example, if the path begins with s3://, the S3FileSystem is used.

  • try_create_dir – If True, attempts to create all directories in the destination path. Does nothing if all directories already exist. Defaults to True.

  • arrow_open_stream_args – kwargs passed to pyarrow.fs.FileSystem.open_output_stream, which is used when opening the file to write to.

  • ray_remote_args – kwargs passed to remote() in the write tasks.

PublicAPI (alpha): This API is in alpha and may change before becoming stable.