imageio.core.Format._can_read#

Format._can_read(request)[source]#

Check if Plugin can read from ImageResource.

This method is called when the format manager is searching for a format to read a certain image. Return True if this format can do it.

The format manager is aware of the extensions and the modes that each format can handle. It will first ask all formats that seem to be able to read it whether they can. If none can, it will ask the remaining formats if they can: the extension might be missing, and this allows formats to provide functionality for certain extensions, while giving preference to other plugins.

If a format says it can, it should live up to it. The format would ideally check the request.firstbytes and look for a header of some kind.

Parameters:
requestRequest

A request that can be used to access the ImageResource and obtain metadata about it.

Returns:
can_readbool

True if the plugin can read from the ImageResource, False otherwise.