import base64


def encode_base64(fpath):
    """ open an image file and encode as base64

        Parameters:
        -----------
            fpath - the path of the target file

        Returns:
        ________
            a base64 string representation of file

    """
    with open(fpath, "rb") as f:
        res = base64.b64encode(f.read())
    return res