SciPy

scipy.misc.fromimage

scipy.misc.fromimage(*args, **kwds)

fromimage is deprecated! fromimage is deprecated in SciPy 1.0.0. and will be removed in 1.2.0. Use np.asarray(im) instead.

Return a copy of a PIL image as a numpy array.

This function is only available if Python Imaging Library (PIL) is installed.

Parameters:
im : PIL image

Input image.

flatten : bool

If true, convert the output to grey-scale.

mode : str, optional

Mode to convert image to, e.g. 'RGB'. See the Notes of the imread docstring for more details.

Returns:
fromimage : ndarray

The different colour bands/channels are stored in the third dimension, such that a grey-image is MxN, an RGB-image MxNx3 and an RGBA-image MxNx4.

Previous topic

scipy.misc.bytescale

Next topic

scipy.misc.imfilter