code: def read_image(
      path: str | Path, image_size: int | tuple[int, int] | None = None
  ) -> np.ndarray:
      """Read image from disk in RGB format.
  
      Args:
          path (str, Path): path to the image file
  
      Example:
          >>> image = read_image("test_image.jpg")
  
      Returns:
          image as numpy array
      """
      path = path if isinstance(path, str) else str(path)
      image = cv2.imread(path)
      image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
  
      if image_size:
          # This part is optional, where the user wants to quickly resize the image
          # with a one-liner code. This would particularly be useful especially when
          # prototyping new ideas.
          height, width = get_image_height_and_width(image_size)
          image = cv2.resize(
              image, dsize=(width, height), interpolation=cv2.INTER_AREA
          )
  
      return image
  
file_path: anomalib/src/anomalib/data/utils/image.py
imports: from __future__ import annotations
  import math
  import warnings
  from pathlib import Path
  import cv2
  import numpy
  import tifffile
  import torch.nn.functional
  from torch import Tensor
  from torchvision.datasets.folder import IMG_EXTENSIONS
label_desc: Use image node_id 5 for calling a global function with example usage: read_image(path, image_size) and returns: image