code: def preprocess_input(image, input_shape):
      net_h, net_w = input_shape
      new_h, new_w, _ = image.shape
  
      # determine the new size of the image
      if (float(net_w) / new_w) < (float(net_h) / new_h):
          new_h = int((new_h * net_w) / new_w)
          new_w = net_w
      else:
          new_w = int((new_w * net_h) / new_h)
          new_h = net_h
  
      # resize the image to the new size
      resized = cv2.resize(
          image[:, :, ::-1] / 255.0, (int(new_w), int(new_h))
      )
  
      # embed the image into the standard letter box
      new_image = np.ones((net_h, net_w, 3)) * 0.5
      new_image[
          int((net_h - new_h) // 2) : int((net_h + new_h) // 2),
          int((net_w - new_w) // 2) : int((net_w + new_w) // 2),
          :,
      ] = resized
      new_image = np.expand_dims(new_image, 0)
  
      return new_image
  
imports: import tensorflow
  from keras import backend
  import numpy
  from PIL import Image
  import cv2
label_desc: Use image node_id 12 for calling a global function with example usage: preprocess_input(image, input_shape) and returns: new_image