Spaces:
Running
Running
Download server/utils.py from P01yH3dr0n/client: direct link, hf CLI and curl.
- Browser
- Download file 316 Bytes
-
https://huggingface.co/spaces/P01yH3dr0n/client/resolve/main/server/utils.py
- Command line
-
hf download hf://spaces/P01yH3dr0n/client/server/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/P01yH3dr0n/client/resolve/main/server/utils.py
316 Bytes
| 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 |