code: def center_crop_img(img: np.ndarray, size: int):
      h, w, c = img.shape
  
      if w == h == size:
          return img
  
      if w < h:
          ratio = size / w
          new_w = size
          new_h = int(h * ratio)
      else:
          ratio = size / h
          new_h = size
          new_w = int(w * ratio)
  
      img = cv2.resize(img, dsize=(new_w, new_h))
  
      if new_w == size:
          h = (new_h - size) // 2
          img = img[h : h + size]
      else:
          w = (new_w - size) // 2
          img = img[:, w : w + size]
  
      return img
  
imports: import cv2
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: center_crop_img(img, size) and returns: img, img