Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions src/PIL/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,18 +767,20 @@ def tobytes(self, encoder_name: str = "raw", *args: Any) -> bytes:

.. warning::

This method returns the raw image data from the internal
storage. For compressed image data (e.g. PNG, JPEG) use
:meth:`~.save`, with a BytesIO parameter for in-memory
data.

:param encoder_name: What encoder to use. The default is to
use the standard "raw" encoder.

A list of C encoders can be seen under
codecs section of the function array in
:file:`_imaging.c`. Python encoders are
registered within the relevant plugins.
This method returns raw image data derived from Pillow's internal
storage. For compressed image data (e.g. PNG, JPEG) use
:meth:`~.save`, with a BytesIO parameter for in-memory data.

:param encoder_name: What encoder to use.

The default is to use the standard "raw" encoder.
To see how this packs pixel data into the returned
bytes, see :file:`libImaging/Pack.c`.

A list of C encoders can be seen under codecs
section of the function array in
:file:`_imaging.c`. Python encoders are registered
within the relevant plugins.
:param args: Extra arguments to the encoder.
:returns: A :py:class:`bytes` object.
"""
Expand Down
Loading