Skip to content

Commit af52060

Browse files
committed
Mention that tobytes() with the raw encoder uses Pack.c
1 parent c8d98d5 commit af52060

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/PIL/Image.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -767,18 +767,20 @@ def tobytes(self, encoder_name: str = "raw", *args: Any) -> bytes:
767767
768768
.. warning::
769769
770-
This method returns the raw image data from the internal
771-
storage. For compressed image data (e.g. PNG, JPEG) use
772-
:meth:`~.save`, with a BytesIO parameter for in-memory
773-
data.
774-
775-
:param encoder_name: What encoder to use. The default is to
776-
use the standard "raw" encoder.
777-
778-
A list of C encoders can be seen under
779-
codecs section of the function array in
780-
:file:`_imaging.c`. Python encoders are
781-
registered within the relevant plugins.
770+
This method returns raw image data derived from Pillow's internal
771+
storage. For compressed image data (e.g. PNG, JPEG) use
772+
:meth:`~.save`, with a BytesIO parameter for in-memory data.
773+
774+
:param encoder_name: What encoder to use.
775+
776+
The default is to use the standard "raw" encoder.
777+
To see how this packs pixel data into the returned
778+
bytes, see :file:`libImaging/Pack.c`.
779+
780+
A list of C encoders can be seen under codecs
781+
section of the function array in
782+
:file:`_imaging.c`. Python encoders are registered
783+
within the relevant plugins.
782784
:param args: Extra arguments to the encoder.
783785
:returns: A :py:class:`bytes` object.
784786
"""

0 commit comments

Comments
 (0)