怎么让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 } }
相关推荐
伍哥的传说19 分钟前
Radash.js 现代化JavaScript实用工具库详解 – 轻量级Lodash替代方案
开发语言·javascript·ecmascript·tree-shaking·radash.js·debounce·throttle
xidianhuihui1 小时前
go install报错: should be v0 or v1, not v2问题解决
开发语言·后端·golang
架构师沉默1 小时前
Java优雅使用Spring Boot+MQTT推送与订阅
java·开发语言·spring boot
点云SLAM1 小时前
PyTorch中flatten()函数详解以及与view()和 reshape()的对比和实战代码示例
人工智能·pytorch·python·计算机视觉·3d深度学习·张量flatten操作·张量数据结构
爱分享的飘哥1 小时前
第三篇:VAE架构详解与PyTorch实现:从零构建AI的“视觉压缩引擎”
人工智能·pytorch·python·aigc·教程·生成模型·代码实战
DebugKitty2 小时前
C语言14-指针4-二维数组传参、指针数组传参、viod*指针
c语言·开发语言·算法·指针传参·void指针·数组指针传参
Bio Coder2 小时前
R语言中 read.table 和 read.delim 之间的区别
开发语言·r语言
进击的铁甲小宝2 小时前
Django-environ 入门教程
后端·python·django·django-environ
落魄实习生2 小时前
UV安装并设置国内源
python·uv
阿克兔3 小时前
建筑兔零基础python自学记录114|正则表达式(1)-18
python