imageio.v3.imread#

imageio.v3.imread(uri, *, index=None, plugin=None, extension=None, format_hint=None, **kwargs)[source]#

Read an ndimage from a URI.

Opens the given URI and reads an ndimage from it. The exact behavior depends on both the file type and plugin used to open the file. To learn about the exact behavior, check the documentation of the relevant plugin. Typically, imread attempts to read all data stored in the URI.

Parameters:
uri{str, pathlib.Path, bytes, file}

The resource to load the image from, e.g. a filename, pathlib.Path, http address or file object, see the docs for more info.

index{int, Ellipsis, None}

If the ImageResource contains multiple ndimages, and index is an integer, select the index-th ndimage from among them and return it. If index is an ellipsis (…), read all ndimages in the file and stack them along a new batch dimension. If index is None, let the plugin decide.

plugin{str, None}

The plugin to use. If set to None (default) imread will perform a search for a matching plugin. If not None, this takes priority over the provided format hint (if present).

extensionstr

If not None, treat the provided ImageResource as if it had the given extension. This affects the order in which backends are considered.

format_hintstr

Deprecated. Use extension instead.

**kwargs

Additional keyword arguments will be passed to the plugin’s read call.

Returns:
imagendimage

The ndimage located at the given URI.