tf.keras.preprocessing.image.load_img( path, grayscale=False, target_size=None, interpolation='nearest' )
Defined in tensorflow/python/keras/_impl/keras/preprocessing/image.py
.
Loads an image into PIL format.
path
: Path to image filegrayscale
: Boolean, whether to load the image as grayscale.target_size
: Either None
(default to original size) or tuple of ints (img_height, img_width)
.interpolation
: Interpolation method used to resample the image if the target size is different from that of the loaded image. Supported methods are "nearest", "bilinear", and "bicubic". If PIL version 1.1.3 or newer is installed, "lanczos" is also supported. If PIL version 3.4.0 or newer is installed, "box" and "hamming" are also supported. By default, "nearest" is used.A PIL Image instance.
ImportError
: if PIL is not available.ValueError
: if interpolation method is not supported.
© 2018 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/image/load_img