mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
Merge pull request #3301 from radarhere/numpy
Added NumPy to documentation
This commit is contained in:
commit
1ec5a6452f
|
@ -2440,9 +2440,20 @@ def fromarray(obj, mode=None):
|
|||
Creates an image memory from an object exporting the array interface
|
||||
(using the buffer protocol).
|
||||
|
||||
If obj is not contiguous, then the tobytes method is called
|
||||
If **obj** is not contiguous, then the tobytes method is called
|
||||
and :py:func:`~PIL.Image.frombuffer` is used.
|
||||
|
||||
If you have an image in NumPy::
|
||||
|
||||
from PIL import Image
|
||||
import numpy as np
|
||||
im = Image.open('hopper.jpg')
|
||||
a = numpy.asarray(im)
|
||||
|
||||
Then this can be used to convert it to a Pillow image::
|
||||
|
||||
im = Image.fromarray(a)
|
||||
|
||||
:param obj: Object with array interface
|
||||
:param mode: Mode to use (will be determined from type if None)
|
||||
See: :ref:`concept-modes`.
|
||||
|
|
Loading…
Reference in New Issue
Block a user