code: def get_image_data(image_file: str, use_b64=True) -> bytes:
      if image_file.startswith("http://") or image_file.startswith(
          "https://"
      ):
          response = requests.get(image_file)
          content = response.content
      elif re.match(r"data:image/(?:png|jpeg);base64,", image_file):
          return re.sub(
              r"data:image/(?:png|jpeg);base64,", "", image_file
          )
      else:
          image = Image.open(image_file).convert("RGB")
          buffered = BytesIO()
          image.save(buffered, format="PNG")
          content = buffered.getvalue()
  
      if use_b64:
          return base64.b64encode(content).decode("utf-8")
      else:
          return content
  
file_path: autogen/autogen/agentchat/contrib/img_utils.py
imports: import base64
  import mimetypes
  import re
  from io import BytesIO
  from typing import Any, Dict, List, Optional, Tuple, Union
  import requests
  from PIL import Image
label_desc: Use image node_id 1 for calling a global function with example usage: get_image_data(image_file, use_b64) and returns: base64, content, re