tf.keras.preprocessing.image.img_to_array

Converts a PIL Image instance to a Numpy array.

Compat aliases for migration

See Migration guide for more details.

tf.compat.v1.keras.preprocessing.image.img_to_array

img PIL Image instance.
data_format Image data format, either "channels_first" or "channels_last".
dtype Dtype to use for the returned array.

A 3D Numpy array.

ValueError if invalid img or data_format is passed.