code: def rescale_size(img_size, target_size):
      scale = min(
          max(target_size) / max(img_size),
          min(target_size) / min(img_size),
      )
      rescaled_size = [round(i * scale) for i in img_size]
      return rescaled_size, scale
  
imports: import cv2
  import numpy
  from PIL import Image, ImageEnhance
  from scipy.ndimage import distance_transform_edt
label_desc: Use image node_id 2 for calling a global function with example usage: rescale_size(img_size, target_size) and returns: rescaled_size,  scale