code: def calculate_dimensions(image_size, desired_size):
          
  
          current_x, current_y = image_size
          target_x, target_y = desired_size
  
          if current_x < target_x and current_y < target_y:
              return None
  
          if current_x > target_x:
              new_x0 = floor(current_x / 2)
              new_x = new_x0 - ceil(target_x / 2)
              new_width = target_x
          else:
              new_x = 0
              new_width = current_x
  
          if current_y > target_y:
              new_y0 = floor(current_y / 2)
              new_y = new_y0 - ceil(target_y / 2)
              new_height = target_y
          else:
              new_y = 0
              new_height = current_y
  
          return (int(new_x), int(new_y), new_width, new_height)
docs: Return the Tuple with the arguments to pass to Image.crop.
  
          If the image is smaller than than the desired_size Don't do
          anything. Otherwise, first calculate the (truncated) center and then
          take half the width and height (truncated again) for x and y.
  
          x0, y0: the center coordinates