import base64 | |
from PIL import Image | |
from io import BytesIO | |
def visualize_base64_image(base64_string:str): | |
""" | |
Visualize a base64-encoded image string. | |
Args: | |
base64_string: The base64-encoded image string. | |
""" | |
# Decode the base64 string back to binary | |
image_data = base64.b64decode(base64_string) | |
# Create an image from the binary data | |
img = Image.open(BytesIO(image_data)) | |
img.show() |