from typing import Union
from pathlib import Path


def get_image_type(p: Union[str, Path]) -> str:
    """Returns the type of image, i.e. jpeg or png."""
    if isinstance(p, Path):
        return p.suffix
    return p.split('.')[-1]