code: def get_new_size(img_size, resize_size):
      if (
          isinstance(resize_size, int) or len(resize_size) == 1
      ):  # specified size only for the smallest edge
          w, h = img_size
          short, long = (w, h) if w <= h else (h, w)
          requested_new_short = (
              resize_size
              if isinstance(resize_size, int)
              else resize_size[0]
          )
  
          new_short, new_long = requested_new_short, int(
              requested_new_short * long / short
          )
  
          new_w, new_h = (
              (new_short, new_long) if w <= h else (new_long, new_short)
          )
  
      else:  # specified both h and w
          new_w, new_h = resize_size[1], resize_size[0]
      return (new_w, new_h)
  
imports: import numpy
  import PIL
  from PIL import Image
label_desc: Use image node_id 1 for calling a global function with example usage: get_new_size(img_size, resize_size) and returns: new_w,  new_h