code: def center_crop(x, crop_h, crop_w=None, resize_w=64):
      # crop the images to [crop_h,crop_w,3] then resize to [resize_h,resize_w,3]
      if crop_w is None:
          crop_w = crop_h  # the width and height after cropped
      h, w = x.shape[:2]
      j = int(round((h - crop_h) / 2.0))
      i = int(round((w - crop_w) / 2.0))
      return np.array(
          Image.fromarray(
              x[j : j + crop_h, i : i + crop_w].astype(np.uint8)
          ).resize([resize_w, resize_w])
      )
  
file_path: analytics-zoo/apps/variational-autoencoder/utils.py
imports: import numpy
  import imageio
  from PIL import Image
label_desc: Use image node_id 1 for calling a global function with example usage: center_crop(x, crop_h, crop_w, resize_w) and returns: np