Skip to contents

Read image files within a directory and convert each file into a record within the resulting Spark dataframe. The output will be a Spark dataframe consisting of struct types containing the following attributes:

  • origin: StringType

  • height: IntegerType

  • width: IntegerType

  • nChannels: IntegerType

  • mode: IntegerType

  • data: BinaryType

Usage

spark_read_image(
  sc,
  name = NULL,
  dir = name,
  drop_invalid = TRUE,
  repartition = 0,
  memory = TRUE,
  overwrite = TRUE
)

Arguments

sc

A spark_connection.

name

The name to assign to the newly generated table.

dir

Directory to read binary files from.

drop_invalid

Whether to drop files that are not valid images from the result (default: TRUE).

repartition

The number of partitions used to distribute the generated table. Use 0 (the default) to avoid partitioning.

memory

Boolean; should the data be loaded eagerly into memory? (That is, should the table be cached?)

overwrite

Boolean; overwrite the table with the given name if it already exists?