The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
copy metadata into modified image
Chrisedcff9ab8a37
diff --git a/server.py b/server.pyindex 538f9075f..1cac3281c 100644--- a/server.py+++ b/server.py@@ -12,6 +12,7 @@ import jsonimport globimport structfrom PIL import Image, ImageOps+from PIL.PngImagePlugin import PngInfofrom io import BytesIOtry:@@ -233,13 +234,16 @@ class PromptServer():if os.path.isfile(file):with Image.open(file) as original_pil:+ metadata = PngInfo()+ for key in original_pil.text:+ metadata.add_text(key, original_pil.text[key])original_pil = original_pil.convert('RGBA')mask_pil = Image.open(image.file).convert('RGBA')# alpha copynew_alpha = mask_pil.getchannel('A')original_pil.putalpha(new_alpha)- original_pil.save(filepath, compress_level=4)+ original_pil.save(filepath, compress_level=4, pnginfo=metadata)return image_upload(post, image_save_function)