W3cubDocs

/TensorFlow Python

tf.keras.preprocessing.image.load_img

load_img(
    path,
    grayscale=False,
    target_size=None
)

Defined in tensorflow/python/keras/_impl/keras/preprocessing/image.py.

Loads an image into PIL format.

Arguments:

  • path: Path to image file
  • grayscale: Boolean, whether to load the image as grayscale.
  • target_size: Either None (default to original size) or tuple of ints (img_height, img_width).

Returns:

A PIL Image instance.

Raises:

  • ImportError: if PIL is not available.

© 2017 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