document Image.open(formats=...) parameter

This commit is contained in:
nulano 2020-08-03 00:38:59 +02:00
parent 2b061b68db
commit 30c4945d9c

View File

@ -2851,6 +2851,11 @@ def open(fp, mode="r", formats=None):
``file.seek``, and ``file.tell`` methods, ``file.seek``, and ``file.tell`` methods,
and be opened in binary mode. and be opened in binary mode.
:param mode: The mode. If given, this argument must be "r". :param mode: The mode. If given, this argument must be "r".
:param formats: A list or tuple of formats to attempt to load the file in.
This can be used to restrict the set of formats checked.
Pass ``None`` to try all supported formats. You can print the set of
available formats by running ``python -m PIL`` or using
the :py:func:`PIL.features.pilinfo` function.
:returns: An :py:class:`~PIL.Image.Image` object. :returns: An :py:class:`~PIL.Image.Image` object.
:exception FileNotFoundError: If the file cannot be found. :exception FileNotFoundError: If the file cannot be found.
:exception PIL.UnidentifiedImageError: If the image cannot be opened and :exception PIL.UnidentifiedImageError: If the image cannot be opened and