client / server /utils.py
P01yH3dr0n's picture
launch
774fe36
Raw
History Blame Contribute Delete
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