Merge pull request #4847 from radarhere/spam

This commit is contained in:
Hugo van Kemenade 2020-08-10 16:19:52 +03:00 committed by GitHub
commit afbbdf5f72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,8 +87,10 @@ true color.
Image.register_open(SpamImageFile.format, SpamImageFile, _accept) Image.register_open(SpamImageFile.format, SpamImageFile, _accept)
Image.register_extension(SpamImageFile.format, ".spam") Image.register_extensions(SpamImageFile.format, [
Image.register_extension(SpamImageFile.format, ".spa") # DOS version ".spam",
".spa", # DOS version
])
The format handler must always set the The format handler must always set the
@ -103,6 +105,15 @@ Note that the image plugin must be explicitly registered using
:py:func:`PIL.Image.register_open`. Although not required, it is also a good :py:func:`PIL.Image.register_open`. Although not required, it is also a good
idea to register any extensions used by this format. idea to register any extensions used by this format.
Once the plugin has been imported, it can be used:
.. code-block:: python
from PIL import Image
import SpamImagePlugin
with Image.open("hopper.spam") as im:
pass
The ``tile`` attribute The ``tile`` attribute
---------------------- ----------------------
@ -148,6 +159,8 @@ can be used with most uncompressed file formats, such as PPM, BMP, uncompressed
TIFF, and many others. To use the raw decoder with the TIFF, and many others. To use the raw decoder with the
:py:func:`PIL.Image.frombytes` function, use the following syntax:: :py:func:`PIL.Image.frombytes` function, use the following syntax::
.. code-block:: python
image = Image.frombytes( image = Image.frombytes(
mode, size, data, "raw", mode, size, data, "raw",
raw mode, stride, orientation raw mode, stride, orientation
@ -258,6 +271,8 @@ image memory.
To use the bit decoder with the :py:func:`PIL.Image.frombytes` function, use To use the bit decoder with the :py:func:`PIL.Image.frombytes` function, use
the following syntax:: the following syntax::
.. code-block:: python
image = Image.frombytes( image = Image.frombytes(
mode, size, data, "bit", mode, size, data, "bit",
bits, pad, fill, sign, orientation bits, pad, fill, sign, orientation
@ -414,4 +429,3 @@ Python-based file decoder:
3. Cleanup: The decoder instance's ``cleanup`` method is called. 3. Cleanup: The decoder instance's ``cleanup`` method is called.