code: def get_size_dict(
      size: Union[int, Iterable[int], Dict[str, int]] = None,
      max_size: Optional[int] = None,
      height_width_order: bool = True,
      default_to_square: bool = True,
      param_name="size",
  ) -> dict:
      """
      Converts the old size parameter in the config into the new dict expected in the config. This is to ensure backwards
      compatibility with the old image processor configs and removes ambiguity over whether the tuple is in (height,
      width) or (width, height) format.
  
      - If `size` is tuple, it is converted to `{"height": size[0], "width": size[1]}` or `{"height": size[1], "width":
      size[0]}` if `height_width_order` is `False`.
      - If `size` is an int, and `default_to_square` is `True`, it is converted to `{"height": size, "width": size}`.
      - If `size` is an int and `default_to_square` is False, it is converted to `{"shortest_edge": size}`. If `max_size`
        is set, it is added to the dict as `{"longest_edge": max_size}`.
  
      Args:
          size (`Union[int, Iterable[int], Dict[str, int]]`, *optional*):
              The `size` parameter to be cast into a size dictionary.
          max_size (`Optional[int]`, *optional*):
              The `max_size` parameter to be cast into a size dictionary.
          height_width_order (`bool`, *optional*, defaults to `True`):
              If `size` is a tuple, whether it's in (height, width) or (width, height) order.
          default_to_square (`bool`, *optional*, defaults to `True`):
              If `size` is an int, whether to default to a square image or not.
      """
      if not isinstance(size, dict):
          size_dict = convert_to_size_dict(
              size, max_size, default_to_square, height_width_order
          )
          logger.info(
              f"{param_name} should be a dictionary on of the following set of keys: {VALID_SIZE_DICT_KEYS}, got {size}."
              f" Converted to {size_dict}.",
          )
      else:
          size_dict = size
  
      if not is_valid_size_dict(size_dict):
          raise ValueError(
              f"{param_name} must have one of the following set of keys: {VALID_SIZE_DICT_KEYS}, got {size_dict.keys()}"
          )
      return size_dict
  
imports: import copy
  import json
  import os
  import warnings
  from io import BytesIO
  from typing import Any, Dict, Iterable, List, Optional, Tuple, Union
  import numpy
  import requests
  from .dynamic_module_utils import custom_object_save
  from .feature_extraction_utils import BatchFeature
  from .image_transforms import center_crop, normalize, rescale
  from .image_utils import ChannelDimension
  from .utils import IMAGE_PROCESSOR_NAME, PushToHubMixin, add_model_info_to_auto_map, cached_file, copy_func, download_url, is_offline_mode, is_remote_url, is_vision_available, logging
label_desc: Use image node_id 3 for calling a global function with example usage: get_size_dict(size, max_size, height_width_order, default_to_square, param_name) and returns: size_dict