21 lines
480 B
Python
21 lines
480 B
Python
import sys
|
|
import zlib
|
|
import json
|
|
import piexif
|
|
from PIL import Image
|
|
import uu
|
|
from io import BytesIO
|
|
|
|
from ketrface.util import *
|
|
|
|
face_base = "../"
|
|
faceId = int(sys.argv[1])
|
|
path = f'{face_base}faces/{"{:02d}".format(faceId % 10)}'
|
|
|
|
img = Image.open(f'{path}/{faceId}.jpg')
|
|
exif_dict = piexif.load(img.info["exif"])
|
|
compressed_str = exif_dict["Exif"][piexif.ExifIFD.UserComment]
|
|
|
|
str = zlib_uudecode(compressed_str)
|
|
parsed = json.loads(str)
|
|
print(json.dumps(parsed, indent=2)) |