code: def image_from_url_text(filedata):
      if filedata is None:
          return None
  
      if (
          type(filedata) == list
          and filedata
          and type(filedata[0]) == dict
          and filedata[0].get("is_file", False)
      ):
          filedata = filedata[0]
  
      if type(filedata) == dict and filedata.get("is_file", False):
          filename = filedata["name"]
          is_in_right_dir = ui_tempdir.check_tmp_file(
              shared.demo, filename
          )
          assert (
              is_in_right_dir
          ), "trying to open image file outside of allowed directories"
  
          filename = filename.rsplit("?", 1)[0]
          return Image.open(filename)
  
      if type(filedata) == list:
          if len(filedata) == 0:
              return None
  
          filedata = filedata[0]
  
      if filedata.startswith("data:image/png;base64,"):
          filedata = filedata[len("data:image/png;base64,") :]
  
      filedata = base64.decodebytes(filedata.encode("utf-8"))
      image = Image.open(io.BytesIO(filedata))
      return image
  
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 4 for calling a global function with example usage: image_from_url_text(filedata) and returns: image, None, Image, None