def b64_2_img(data: str) -> ImageFile:
    """
    Convert base64 encoded image string to a PIL.Image.

    Args:
        data (str): The base64 encoded image string.

    Returns:
        ImageFile: A PIL Image object.

    """
    buff = BytesIO(base64.b64decode(data))
    return cast(ImageFile, Image.open(buff))

    Convert base64 encoded image string to a PIL.Image.

    Args:
        data (str): The base64 encoded image string.

    Returns:
        ImageFile: A PIL Image object.

    
llama-index-core/llama_index/core/img_utils.py