Spaces:
Paused
Paused
P01yH3dr0n
commited on
Commit
•
b604c04
1
Parent(s):
2155b95
Update pnginfo.py
Browse files- pnginfo.py +0 -12
pnginfo.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
from PIL import Image
|
2 |
-
import piexif
|
3 |
import json
|
4 |
import html
|
5 |
import re
|
@@ -31,17 +30,6 @@ def read_info_from_image(image) -> tuple[str | None, dict]:
|
|
31 |
image = Image.open(image)
|
32 |
items = (image.info or {}).copy()
|
33 |
info =''
|
34 |
-
if "exif" in items:
|
35 |
-
exif = piexif.load(items["exif"])
|
36 |
-
exif_comment = (exif or {}).get("Exif", {}).get(piexif.ExifIFD.UserComment, b'')
|
37 |
-
try:
|
38 |
-
exif_comment = piexif.helper.UserComment.load(exif_comment)
|
39 |
-
except ValueError:
|
40 |
-
exif_comment = exif_comment.decode('utf8', errors="ignore")
|
41 |
-
|
42 |
-
if exif_comment:
|
43 |
-
items['exif comment'] = exif_comment
|
44 |
-
geninfo = exif_comment
|
45 |
|
46 |
for field in IGNORED_INFO_KEYS:
|
47 |
items.pop(field, None)
|
|
|
1 |
from PIL import Image
|
|
|
2 |
import json
|
3 |
import html
|
4 |
import re
|
|
|
30 |
image = Image.open(image)
|
31 |
items = (image.info or {}).copy()
|
32 |
info =''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
for field in IGNORED_INFO_KEYS:
|
35 |
items.pop(field, None)
|