code: def square_pad(self, img):
      h, w = img.shape[:2]
      if h == w:
          return img, (0, 0)
      pad_size = max(h, w)
      if self.pad_with_fixed_color:
          expand_img = np.ones((pad_size, pad_size, 3), dtype=np.uint8)
          expand_img[:] = self.pad_value
      else:
          (h_ind, w_ind) = (
              np.random.randint(0, h * 7 // 8),
              np.random.randint(0, w * 7 // 8),
          )
          img_cut = img[
              h_ind : (h_ind + h // 9), w_ind : (w_ind + w // 9)
          ]
          expand_img = cv2.resize(img_cut, (pad_size, pad_size))
      if h > w:
          y0, x0 = 0, (h - w) // 2
      else:
          y0, x0 = (w - h) // 2, 0
      expand_img[y0 : y0 + h, x0 : x0 + w] = img
      offset = (x0, y0)
  
      return expand_img, offset
  
imports: import numpy
  from PIL import Image, ImageDraw
  import cv2
  from shapely.geometry import Polygon
  import math
  from ppocr.utils.poly_nms import poly_intersection
label_desc: Use image node_id 3 for calling the SquareResizePad obj's underlying member method code with example usage: obj.square_pad(img) and returns: expand_img,  offset, img,  int,  int