code: def caption_image_overlay(
      srcimage, title, footerLeft, footerMid, footerRight, textfont=None
  ):
      from modules.images import get_font
  
      if textfont:
          warnings.warn(
              "passing in a textfont to caption_image_overlay is deprecated and does nothing",
              DeprecationWarning,
              stacklevel=2,
          )
      from math import cos
  
      image = srcimage.copy()
      fontsize = 32
      factor = 1.5
      gradient = Image.new(
          "RGBA", (1, image.size[1]), color=(0, 0, 0, 0)
      )
      for y in range(image.size[1]):
          mag = 1 - cos(y / image.size[1] * factor)
          mag = max(
              mag,
              1
              - cos((image.size[1] - y) / image.size[1] * factor * 1.1),
          )
          gradient.putpixel((0, y), (0, 0, 0, int(mag * 255)))
      image = Image.alpha_composite(
          image.convert("RGBA"), gradient.resize(image.size)
      )
  
      draw = ImageDraw.Draw(image)
  
      font = get_font(fontsize)
      padding = 10
  
      _, _, w, h = draw.textbbox((0, 0), title, font=font)
      fontsize = min(
          int(
              fontsize * (((image.size[0] * 0.75) - (padding * 4)) / w)
          ),
          72,
      )
      font = get_font(fontsize)
      _, _, w, h = draw.textbbox((0, 0), title, font=font)
      draw.text(
          (padding, padding),
          title,
          anchor="lt",
          font=font,
          fill=(255, 255, 255, 230),
      )
  
      _, _, w, h = draw.textbbox((0, 0), footerLeft, font=font)
      fontsize_left = min(
          int(fontsize * (((image.size[0] / 3) - (padding)) / w)), 72
      )
      _, _, w, h = draw.textbbox((0, 0), footerMid, font=font)
      fontsize_mid = min(
          int(fontsize * (((image.size[0] / 3) - (padding)) / w)), 72
      )
      _, _, w, h = draw.textbbox((0, 0), footerRight, font=font)
      fontsize_right = min(
          int(fontsize * (((image.size[0] / 3) - (padding)) / w)), 72
      )
  
      font = get_font(min(fontsize_left, fontsize_mid, fontsize_right))
  
      draw.text(
          (padding, image.size[1] - padding),
          footerLeft,
          anchor="ls",
          font=font,
          fill=(255, 255, 255, 230),
      )
      draw.text(
          (image.size[0] / 2, image.size[1] - padding),
          footerMid,
          anchor="ms",
          font=font,
          fill=(255, 255, 255, 230),
      )
      draw.text(
          (image.size[0] - padding, image.size[1] - padding),
          footerRight,
          anchor="rs",
          font=font,
          fill=(255, 255, 255, 230),
      )
  
      return image
  
imports: import base64
  import json
  import warnings
  import numpy
  import zlib
  from PIL import Image, ImageDraw
  import torch
label_desc: Use image node_id 9 for calling a global function with example usage: caption_image_overlay(srcimage, title, footerLeft, footerMid, footerRight, textfont) and returns: image