scipy.misc.toimage¶
-
scipy.misc.
toimage
(*args, **kwds)¶ toimage
is deprecated!toimage
is deprecated in SciPy 1.0.0, and will be removed in 1.2.0. Use Pillow’sImage.fromarray
directly instead.Takes a numpy array and returns a PIL image.
This function is only available if Python Imaging Library (PIL) is installed.
The mode of the PIL image depends on the array shape and the pal and mode keywords.
For 2-D arrays, if pal is a valid (N,3) byte-array giving the RGB values (from 0 to 255) then
mode='P'
, otherwisemode='L'
, unless mode is given as ‘F’ or ‘I’ in which case a float and/or integer array is made.Warning
This function uses
bytescale
under the hood to rescale images to use the full (0, 255) range ifmode
is one ofNone, 'L', 'P', 'l'
. It will also cast data for 2-D images touint32
formode=None
(which is the default).Notes
For 3-D arrays, the channel_axis argument tells which dimension of the array holds the channel data.
For 3-D arrays if one of the dimensions is 3, the mode is ‘RGB’ by default or ‘YCbCr’ if selected.
The numpy array must be either 2 dimensional or 3 dimensional.