diff --git a/shared.py b/shared.py index d3499f3..0e36a04 100644 --- a/shared.py +++ b/shared.py @@ -88,22 +88,23 @@ def GenThumb(fname): bands = im.getbands() if 'A' in bands: im = im.convert('RGB') + orig_w, orig_h = im.size im.thumbnail((THUMBSIZE,THUMBSIZE)) img_bytearray = io.BytesIO() im.save(img_bytearray, format='JPEG') img_bytearray = img_bytearray.getvalue() thumbnail = base64.b64encode(img_bytearray) thumbnail = str(thumbnail)[2:-1] - return thumbnail + return thumbnail, orig_w, orig_h except Exception as e: print( f"GenThumb failed: {e}") - return None + return None, None, None def GenFace(fname): img = face_recognition.load_image_file(fname) location = face_recognition.face_locations(img) encodings = face_recognition.face_encodings(img, known_face_locations=location) if len(encodings): - return encodings[0].tobytes() + return encodings[0].tobytes(), location else: - return None + return None, None