def pil_loader(path: str) -> Image.Image:
    """Loads an image using PIL.

    Args:
        path: Path to the image file.

    Returns:
        A PIL Image in RGB format.
    """
    # open path as file to avoid ResourceWarning
    # (https://github.com/python-pillow/Pillow/issues/835)
    with open(path, "rb") as f:
        img = Image.open(f)
        return img.convert("RGB")
Loads an image using PIL.

    Args:
        path: Path to the image file.

    Returns:
        A PIL Image in RGB format.
    
lightly/data/_image_loaders.py