code: def add_paste_fields(
      tabname, init_img, fields, override_settings_component=None
  ):
      paste_fields[tabname] = {
          "init_img": init_img,
          "fields": fields,
          "override_settings_component": override_settings_component,
      }
  
      # backwards compatibility for existing extensions
      import modules.ui
  
      if tabname == "txt2img":
          modules.ui.txt2img_paste_fields = fields
      elif tabname == "img2img":
          modules.ui.img2img_paste_fields = fields
  
imports: from __future__ import annotations
  import base64
  import io
  import json
  import os
  import re
  import gradio
  from modules.paths import data_path
  from modules import shared, ui_tempdir, script_callbacks, processing
  from PIL import Image
label_desc: Use image node_id 5 for calling a global function with example usage: add_paste_fields(tabname, init_img, fields, override_settings_component) without return types