code: def resize_and_crop_image(image, dim):
      if image.shape[0] > image.shape[1]:
          img = image_resize(image, width=dim)
          yshift, xshift = (image.shape[0] - image.shape[1]) // 2, 0
          y_start = (img.shape[0] - img.shape[1]) // 2
          y_end = y_start + dim
          return img[y_start:y_end, :, :], (xshift, yshift)
      else:
          img = image_resize(image, height=dim)
          yshift, xshift = 0, (image.shape[1] - image.shape[0]) // 2
          x_start = (img.shape[1] - img.shape[0]) // 2
          x_end = x_start + dim
          return img[:, x_start:x_end, :], (xshift, yshift)
  
imports: import cv2
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: resize_and_crop_image(image, dim) and returns: img,  xshift,  yshift, img,  xshift,  yshift