TensorFlow provides tf.io and tf.image modules for reading and processing the images. Below is the code snippet for reading and processing images with tf.io and tf.image . RUn the code snippet in Jupyter or Colab notebook.
import tensorflow as tf
import matplotlib.pyplot as plt
image=tf.io.read_file("flower.jpg")
image = tf.io.decode_jpeg(image)
plt.figure()
plt.imshow(image)
image = tf.image.flip_left_right(image)
plt.figure()
plt.imshow(image)
image = tf.image.flip_up_down(image)
plt.figure()
plt.imshow(image)
image = tf.image.adjust_brightness(image, delta=0.5)
plt.figure()
plt.imshow(image)
Category: TensorFlow