Spaces:
Running
Running
| import io | |
| from PIL import Image | |
| def extract_png_info(image_bytes: bytes) -> dict: | |
| """Extract text metadata from PNG.""" | |
| info = {} | |
| try: | |
| img = Image.open(io.BytesIO(image_bytes)) | |
| if hasattr(img, 'text'): | |
| info = dict(img.text) | |
| except Exception: | |
| pass | |
| return info |