Image.nplanes#

property Image.nplanes: int[source]#

Number of color planes

Returns:

Number of color planes, or None if image is empty

Return type:

int

For a 2D or greyscale image this is one, otherwise it is the third dimension of the image.

Example:

>>> from machinevisiontoolbox import Image
>>> img = Image.Read('street.png')
>>> img.nplanes
1
>>> img = Image.Read('flowers1.png')
>>> img.nplanes
3

Note

A greyscale image is stored internally as a 2D NumPy array which has zero planes, but nplanes will return 1 in that case.

Seealso:

iscolor shape ndim