mindspore.dataset.vision.get_image_size

View Source On Gitee
mindspore.dataset.vision.get_image_size(image)[source]

Get the size of input image as [height, width].

Parameters

image (Union[numpy.ndarray, PIL.Image.Image]) – The image to get size.

Returns

list[int, int], the image size.

Raises
  • RuntimeError – If the dimension of image is less than 2.

  • TypeError – If image is not of type <class 'numpy.ndarray'> or <class 'PIL.Image.Image'>.

Examples

>>> import mindspore.dataset.vision as vision
>>> from PIL import Image
>>> image = Image.open("/path/to/image_file")
>>> image_size = vision.get_image_size(image)