code: def pad_with_black(src: Image.Image, w: int, h: int) -> Image.Image:
      """
      Returns the image src with the x dimension padded to width w if it was
      smaller than w (and likewise for the y dimension with height h)
      """
      curr_w, curr_h = src.size
      dx = max(0, (w - curr_w) // 2)
      dy = max(0, (h - curr_h) // 2)
      padded = Image.new("RGB", (w, h))
      padded.paste(src, (dx, dy, curr_w + dx, curr_h + dy))
      return padded
  
file_path: AugLy/augly/image/utils/utils.py
imports: import functools
  import json
  import math
  import os
  from typing import List, Optional, Tuple, Union
  import numpy
  from augly import utils
  from PIL import Image
label_desc: Use image node_id 6 for calling a global function with example usage: pad_with_black(src, w, h) and returns: padded