from typing import TypeVar

import numpy as np
import numpy.typing as npt
from PIL import Image

ImageType = TypeVar("ImageType", npt.NDArray[np.uint8], Image.Image)
"""
An image of type `np.ndarray` or `PIL.Image.Image`.

Unlike a `Union`, ensures the type remains consistent. If a function
takes an `ImageType` argument and returns an `ImageType`, when you
pass an `np.ndarray`, you will get an `np.ndarray` back.
"""
