From c4e90bf6893eb61cbc9f5a8bcc71aa4a2c344d8f Mon Sep 17 00:00:00 2001 From: JJ Date: Wed, 14 Sep 2022 20:38:40 +1000 Subject: [PATCH] format exif string * UserComment needs an ID code at the start of the tag area. This is provided by piexif.helper.UserComment, otherwise an "Warning Invalid EXIF text encoding for UserComment" is thrown upon reading the exif data --- modules/images.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/images.py b/modules/images.py index d48a8ab2..db68f405 100644 --- a/modules/images.py +++ b/modules/images.py @@ -325,8 +325,8 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='png', i if extension.lower() in ("jpg", "jpeg", "webp"): exif_bytes = piexif.dump({ "Exif": { - piexif.ExifIFD.UserComment: info.encode("utf8"), - } + piexif.ExifIFD.UserComment: piexif.helper.UserComment.dump(info) + }, }) else: exif_bytes = None