code: def get_image_size(fname):
      """
      Determine the image type of fhandle and return its size.
      Taken from https://stackoverflow.com/a/39778771
      """
      with open(fname, "rb") as fhandle:
          head = fhandle.read(24)
          if len(head) != 24:
              return
          what = imghdr.what(None, head)
          if what == "png":
              check = struct.unpack(">i", head[4:8])[0]
              if check != 0x0D0A1A0A:
                  return
              width, height = struct.unpack(">ii", head[16:24])
          elif what == "gif":
              width, height = struct.unpack("<HH", head[6:10])
          elif what == "jpeg":
              try:
                  fhandle.seek(0)  # Read 0xff next
                  size = 2
                  ftype = 0
                  while not 0xC0 <= ftype <= 0xCF or ftype in (
                      0xC4,
                      0xC8,
                      0xCC,
                  ):
                      fhandle.seek(size, 1)
                      byte = fhandle.read(1)
                      while ord(byte) == 0xFF:
                          byte = fhandle.read(1)
                      ftype = ord(byte)
                      size = struct.unpack(">H", fhandle.read(2))[0] - 2
                  # We are at a SOFn block
                  fhandle.seek(1, 1)  # Skip `precision' byte.
                  height, width = struct.unpack(">HH", fhandle.read(4))
              except Exception:  # IGNORE:W0703
                  return
          else:
              return
  
          return width, height
  
imports: import xml.etree.ElementTree
  from collections import OrderedDict
  import json
  import struct
  import imghdr
  import numpy
  from .geom import pt, rect
label_desc: Use image node_id 12 for calling a global function with example usage: get_image_size(fname) and returns: width,  height