Sounds like crop_to_bounding_box is doing what you need:
import tensorflow as tf
def crop_center(image):
h, w = image.shape[-3], image.shape[-2]
if h > w:
cropped_image = tf.image.crop_to_bounding_box(image, (h - w) // 2, 0, w, w)
else:
cropped_image = tf.image.crop_to_bounding_box(image, 0, (w - h) // 2, h, h)
return tf.image.resize_images(cropped_image, (100, 100))