import base64 from io import BytesIO from PIL import Image def validate_image_base64(image_base64: str) -> bool: try: Image.open(BytesIO(base64.b64decode(image_base64))) return True except: return False