import base64


def convert_image_file_to_b64_string(filename):
    """Convert a image file to the corresponding b64_string

    This function will all the b64encode function from the base64 module and
    convert the specified image file to b64_string for saving in data bse and
    transmission. The image file could be either JPEG file or PNG file.

    Args:
        filename (str): The name (path)  of image you want to process

    Returns:
        str : The b64_string that was generated

    """
    with open(filename, "rb") as image_file:
        b64_bytes = base64.b64encode(image_file.read())
    b64_string = str(b64_bytes, encoding="utf-8")
    return b64_string