*, index=None, mode=None, rotate=False, apply_gamma=False, as_gray=None) ndarray[source]#

Parses the given URI and creates a ndarray from it.


If the ImageResource contains multiple ndimages, and index is an integer, select the index-th ndimage from among them and return it. If index is an ellipsis (…), read all ndimages in the file and stack them along a new batch dimension and return them. If index is None, this plugin reads the first image of the file (index=0) unless the image is a GIF or APNG, in which case all images are read (index=…).


Convert the image to the given mode before returning it. If None, the mode will be left unchanged. Possible modes can be found at:


If set to True and the image contains an EXIF orientation tag, apply the orientation before returning the ndimage.


If True and the image contains metadata about gamma, apply gamma correction to the image.


Deprecated. Exists to raise a constructive error message.


A numpy array containing the loaded image data


If you open a GIF - or any other format using color pallets - you may wish to manually set the mode parameter. Otherwise, the numbers in the returned image will refer to the entries in the color pallet, which is discarded during conversion to ndarray.