From 485532c1f3c3cf146a37b88f81dd6a0ff077daf1 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Fri, 31 Mar 2023 21:00:28 +1100 Subject: [PATCH] Mention available pixel types when converting from NumPy --- src/PIL/Image.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/PIL/Image.py b/src/PIL/Image.py index cc0b90b1d..259616e2b 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -3041,6 +3041,10 @@ def fromarray(obj, mode=None): If ``obj`` is not contiguous, then the ``tobytes`` method is called and :py:func:`~PIL.Image.frombuffer` is used. + In the case of NumPy, be aware that Pillow modes do not always correspond + to NumPy dtypes. Pillow modes only offer 1-bit pixels, 8-bit pixels, + 32-signed integer pixels and 32-bit floating point pixels. + Pillow images can also be converted to arrays:: from PIL import Image