tf.image.resize

Resize images to size using the specified method.

Used in the notebooks

Used in the guide Used in the tutorials

Resized images will be distorted if their original aspect ratio is not the same as size. To avoid distortions see tf.image.resize_with_pad.

image = tf.constant([
 [1,0,0,0,0],
 [0,1,0,0,0],
 [0,0,1,0,0],
 [0,0,0,1,0],
 [0,0,0,0,1],
])
# Add "batch" and "channels" dimensions
image = image[tf.newaxis, ..., tf.newaxis]