怎么让Comfyui导出的图像不包含工作流信息,

为了数据安全,让Comfyui导出的图像不包含工作流信息,导出的图像就不会拖到comfyui中加载出来工作流。

ComfyUI的目录下node.py

直接移除 pnginfo(推荐)​

save_images 方法中,​​删除或注释掉所有与 metadata 相关的代码​ ​,确保 img.save() 时不传入 pnginfo

python 复制代码
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]
    )
    results = list()
    for (batch_number, image) in enumerate(images):
        i = 255. * image.cpu().numpy()
        img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8))
        
        # 删除或注释掉以下代码,不写入任何元数据
        # metadata = None
        # if not args.disable_metadata:
        #     metadata = PngInfo()
        #     if prompt is not None:
        #         metadata.add_text("prompt", json.dumps(prompt))
        #     if extra_pnginfo is not None:
        #         for x in extra_pnginfo:
        #             metadata.add_text(x, json.dumps(extra_pnginfo[x]))

        filename_with_batch_num = filename.replace("%batch_num%", str(batch_number))
        file = f"{filename_with_batch_num}_{counter:05}_.png"
        
        # 修改此行,移除 pnginfo 参数
        img.save(os.path.join(full_output_folder, file), compress_level=self.compress_level)
        
        results.append({
            "filename": file,
            "subfolder": subfolder,
            "type": self.type
        })
        counter += 1
    return { "ui": { "images": results } }
相关推荐
共享家95271 天前
搭建 AI 聊天机器人:”我的人生我做主“
前端·javascript·css·python·pycharm·html·状态模式
疯狂的喵1 天前
C++编译期多态实现
开发语言·c++·算法
2301_765703141 天前
C++中的协程编程
开发语言·c++·算法
m0_748708051 天前
实时数据压缩库
开发语言·c++·算法
Hgfdsaqwr1 天前
Python在2024年的主要趋势与发展方向
jvm·数据库·python
lly2024061 天前
jQuery Mobile 表格
开发语言
一晌小贪欢1 天前
Python 测试利器:使用 pytest 高效编写和管理单元测试
python·单元测试·pytest·python3·python测试
小文数模1 天前
2026年美赛数学建模C题完整参考论文(含模型和代码)
python·数学建模·matlab
惊讶的猫1 天前
探究StringBuilder和StringBuffer的线程安全问题
java·开发语言
Halo_tjn1 天前
基于封装的专项 知识点
java·前端·python·算法