code: def center_crop(image: Image, w: int, h: int):
      iw, ih = image.size
      if ih / h < iw / w:
          sw = w * ih / h
          box = (iw - sw) / 2, 0, iw - (iw - sw) / 2, ih
      else:
          sh = h * iw / w
          box = 0, (ih - sh) / 2, iw, ih - (ih - sh) / 2
      return image.resize((w, h), Image.Resampling.LANCZOS, box)
  
file_path: stable-diffusion-webui/scripts/processing_autosized_crop.py
imports: from PIL import Image
  from modules import scripts_postprocessing, ui_components
  import gradio
label_desc: Use image node_id 1 for calling a global function with example usage: center_crop(image, w, h) and returns: image