mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-04-20 03:13:30 +00:00
Remove cICP chunk hack
Now supported in Pillow as of 11.2.1 https://github.com/python-pillow/Pillow/pull/8704
This commit is contained in:
parent
49aaad7c21
commit
3a18b3136c
12
nodes.py
12
nodes.py
@ -1601,13 +1601,6 @@ class SaveImage:
|
||||
CATEGORY = "image"
|
||||
DESCRIPTION = "Saves the input images to your ComfyUI output directory."
|
||||
|
||||
def putchunk_patched(self, fp, cid, *data):
|
||||
for chunk in self.extra_chunks:
|
||||
if cid == chunk.lower():
|
||||
cid = chunk
|
||||
break
|
||||
return PngImagePlugin.putchunk(fp, cid, *data)
|
||||
|
||||
def save_images(self, images, filename_prefix="ComfyUI", prompt=None, extra_pnginfo=None):
|
||||
filename_prefix += self.prefix_append
|
||||
full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(filename_prefix, self.output_dir, images[0].shape[1], images[0].shape[0])
|
||||
@ -1632,10 +1625,7 @@ class SaveImage:
|
||||
filename_with_batch_num = filename.replace("%batch_num%", str(batch_number))
|
||||
file = f"{filename_with_batch_num}_{counter:05}_.png"
|
||||
|
||||
#TODO: revert to using img.save once Pillow supports cICP chunk
|
||||
img.encoderinfo = {"pnginfo": metadata, "compress_level": self.compress_level}
|
||||
with open(os.path.join(full_output_folder, file), 'wb') as fp:
|
||||
PngImagePlugin._save(img, fp, None, chunk=self.putchunk_patched)
|
||||
img.save(os.path.join(full_output_folder, file), pnginfo=metadata, compress_level=self.compress_level)
|
||||
|
||||
results.append({
|
||||
"filename": file,
|
||||
|
Loading…
Reference in New Issue
Block a user