code: def get_crop_size(crop_w, crop_h, image_w, image_h):
      
      scale1 = float(crop_w) / float(image_w)
      scale2 = float(crop_h) / float(image_h)
      scale1_w = crop_w  # int(round(img_w * scale1))
      scale1_h = int(round(image_h * scale1))
      scale2_w = int(round(image_w * scale2))
      scale2_h = crop_h  # int(round(img_h * scale2))
  
      if scale1_h > crop_h:  # scale1_w == crop_w
          # crop on vertical
          return (scale1_w, scale1_h)
      else:  # scale2_h == crop_h and scale2_w > crop_w
          #crop on horizontal
          return (scale2_w, scale2_h)
docs: Determines the correct scale size for the image
  
      when img w == crop w and img h > crop h
          Use these dimensions
  
      when img h == crop h and img w > crop w
          Use these dimensions