import imghdr def is_base64_jpg(decoded_string) -> bool: try: image_type = imghdr.what(None, decoded_string) return image_type == "jpeg" except Exception: return False