File size: 484 Bytes
70e3e61 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
""" Encode the image located at the given path to base64 string. """
import base64
# Function to encode the image
def encode_image(image_path):
"""
Encode the image located at the given path to base64 string.
Args:
image_path (str): The path to the image file.
Returns:
str: The base64 encoded string representation of the image.
"""
with open(image_path, "rb") as image_file:
return base64.b64encode(image_file.read()).decode('utf-8')
|