code: def letterbox_image(image, size):
      """resize image with unchanged aspect ratio using padding"""
      image_w, image_h = image.size
      w, h = size
      new_w = int(image_w * min(w / image_w, h / image_h))
      new_h = int(image_h * min(w / image_w, h / image_h))
      resized_image = image.resize((new_w, new_h), Image.BICUBIC)
  
      boxed_image = Image.new("RGB", size, (128, 128, 128))
      boxed_image.paste(
          resized_image, ((w - new_w) // 2, (h - new_h) // 2)
      )
      return boxed_image
  
file_path: MMdnn/mmdnn/conversion/examples/keras/utils.py
imports: import tensorflow
  from keras import backend
  from PIL import Image
label_desc: Use image node_id 1 for calling a global function with example usage: letterbox_image(image, size) and returns: boxed_image