- scipy.misc.toimage(arr, high=255, low=0, cmin=None, cmax=None, pal=None, mode=None, channel_axis=None)[source]¶
Takes a numpy array and returns a PIL image.
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', otherwise mode='L', unless mode is given as ‘F’ or ‘I’ in which case a float and/or integer array is made.
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.