code: def get_img_size(filepath: Union[str, Path]) -> ImgSize:
      """
      Returns image (width, height)
      """
      if ".dcm" in str(filepath).lower():
          image = open_dicom(str(filepath))
          image_size = image.size
      else:
          if is_tif_extension(filepath):
              with rasterio.open(str(filepath), "r") as image:
                  image_size = (image.width, image.height)
          else:
              with PIL.Image.open(str(filepath)) as image:
                  image_size = image.size
  
      try:
          exif = image._getexif()
          if exif is not None and exif[_EXIF_ORIENTATION_TAG] in [6, 8]:
              image_size = image_size[::-1]
      except (AttributeError, KeyError, IndexError):
          # cases: image don't have getexif
          pass
  
      return ImgSize(*image_size)
  
file_path: icevision/icevision/utils/imageio.py
imports: from icevision.imports import *
  from PIL import ExifTags
label_desc: Use image node_id 7 for calling a global function with example usage: get_img_size(filepath) and returns: ImgSize