code: def letterbox(self, img, height, width, color=(127.5, 127.5, 127.5)):
      # letterbox: resize a rectangular image to a padded rectangular
      shape = img.shape[:2]  # [height, width]
      ratio_h = float(height) / shape[0]
      ratio_w = float(width) / shape[1]
      ratio = min(ratio_h, ratio_w)
      new_shape = (
          round(shape[1] * ratio),
          round(shape[0] * ratio),
      )  # [width, height]
      padw = (width - new_shape[0]) / 2
      padh = (height - new_shape[1]) / 2
      top, bottom = round(padh - 0.1), round(padh + 0.1)
      left, right = round(padw - 0.1), round(padw + 0.1)
  
      img = cv2.resize(
          img, new_shape, interpolation=cv2.INTER_AREA
      )  # resized, no border
      img = cv2.copyMakeBorder(
          img,
          top,
          bottom,
          left,
          right,
          cv2.BORDER_CONSTANT,
          value=color,
      )  # padded rectangular
      return img, ratio, padw, padh
  
imports: import cv2
  import numpy
label_desc: Use image node_id 2 for calling the LetterBoxResize obj's underlying member method code with example usage: obj.letterbox(img, height, width, color) and returns: img,  ratio,  padw,  padh