code: def extract_image_information(
      path: Path, exif: bool = False, hash: bool = False
  ) -> dict:
      """Extracts all image information per file, as opening files is slow
  
      Args:
          path: Path to the image
          exif: extract exif information
          hash: calculate hash (for duplicate detection)
  
      Returns:
          A dict containing image information
      """
      information: dict = {}
      image = open_image(path)
      information["opened"] = image is not None
      if image is not None:
          information["truncated"] = is_image_truncated(image)
          if not information["truncated"]:
              information["size"] = image.size
              if exif:
                  information["exif"] = extract_exif(image)
              if hash:
                  information["hash"] = hash_image(image)
  
      return information
  
imports: import imghdr
  from functools import partial
  from pathlib import Path
  from typing import Optional, Tuple, Union
  import imagehash
  import pandas
  from PIL import ExifTags, Image
  from ydata_profiling.config import Settings
  from ydata_profiling.model.summary_algorithms import describe_image_1d, named_aggregate_summary
  from ydata_profiling.utils.imghdr_patch import *
label_desc: Use image node_id 10 for calling a global function with example usage: extract_image_information(path, exif, hash) and returns: information