tosanoob's picture
First upload
aa25f09 verified
raw
history blame contribute delete
393 Bytes
import base64
from PIL import Image
import io
def decode_image(encoded_image):
"""Decode the base64 string to bytes"""
image_data = base64.b64decode(encoded_image)
# Open the image using PIL
image = Image.open(io.BytesIO(image_data))
return image
def encode_image(buffer):
encoded_image = base64.b64encode(buffer).decode('utf-8')
return encoded_image