tf.keras.preprocessing.image.img_to_array
Converts a PIL Image instance to a Numpy array.
tf.keras.preprocessing.image.img_to_array(
img, data_format=None, dtype=None
)
Arguments |
img
|
PIL Image instance.
|
data_format
|
Image data format,
either "channels_first" or "channels_last".
|
dtype
|
Dtype to use for the returned array.
|
Returns |
A 3D Numpy array.
|
Raises |
ValueError
|
if invalid img or data_format is passed.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[null,null,["Last updated 2020-10-01 UTC."],[],[]]