# imageio.core.Format

class imageio.core.Format(name, description, extensions=None, modes=None)

  Represents an implementation to read/write a particular file format

  A format instance is responsible for 1) providing information about a format; 2) determining whether a certain file can be read/written with this format; 3) providing a reader/writer class.

  Generally, imageio will select the right format and use that to read/write an image. A format can also be explicitly chosen in all read/write functions. Use `print(format)`, or `help(format_name)` to see its documentation.

  To implement a specific format, one should create a subclass of Format and the Format.Reader and Format.Writer classes. See `imageio.plugins` for details.

  Parameters:
    name str

      A short name of this format. Users can select a format using its name.

    description str

      A one-line description of the format.

    extensions str | list | None

      List of filename extensions that this format supports. If a string is passed it should be space or comma separated. The extensions are used in the documentation and to allow users to select a format by file extension. It is not used to determine what format to use for reading/saving a file.

    modes str

      A string containing the modes that this format can handle (‘iIvV’), “i” for an image, “I” for multiple images, “v” for a volume, “V” for multiple volumes. This attribute is used in the documentation and to select the formats when reading/saving a file.

  Attributes:
    `description`

      A short description of this format.

    `doc`

      The documentation for this format (name + description + docstring).

    `extensions`

      A list of file extensions supported by this plugin.

    `modes`

      A string specifying the modes that this format can handle.

    `name`

      The name of this format.

  Methods

  `can_read`(request) | Get whether this format can read data from the specified uri.
  `can_write`(request) | Get whether this format can write data to the speciefed uri.
  `get_reader`(request) | Return a reader object that can be used to read data and info from the given file.
  `get_writer`(request) | Return a writer object that can be used to write data and info to the given file.

  Attribute and Method Details

  description

    A short description of this format.

  doc

    The documentation for this format (name + description + docstring).

  extensions

    A list of file extensions supported by this plugin. These are all lowercase with a leading dot.

  modes

    A string specifying the modes that this format can handle.

  name

    The name of this format.

  can_read(request)

    Get whether this format can read data from the specified uri.

  can_write(request)

    Get whether this format can write data to the speciefed uri.

  get_reader(request)

    Return a reader object that can be used to read data and info from the given file. Users are encouraged to use imageio.get_reader() instead.

  get_writer(request)

    Return a writer object that can be used to write data and info to the given file. Users are encouraged to use imageio.get_writer() instead.

previous

The ImageIO Plugin API

next

imageio.core.Request