code: def square_crop(im, S):
      if im.shape[0] > im.shape[1]:
          height = S
          width = int(float(im.shape[1]) / im.shape[0] * S)
          scale = float(S) / im.shape[0]
      else:
          width = S
          height = int(float(im.shape[0]) / im.shape[1] * S)
          scale = float(S) / im.shape[1]
      resized_im = cv2.resize(im, (width, height))
      det_im = np.zeros((S, S, 3), dtype=np.uint8)
      det_im[
          : resized_im.shape[0], : resized_im.shape[1], :
      ] = resized_im
      return det_im, scale
  
file_path: insightface/python-package/insightface/utils/face_align.py
imports: import cv2
  import numpy
  from skimage import transform
label_desc: Use image node_id 4 for calling a global function with example usage: square_crop(im, S) and returns: det_im,  scale