怎么让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 } }
相关推荐
Csvn20 小时前
异常处理与错误调试
python
Csvn20 小时前
Python 面向对象编程基础:类与对象
python
yy我不解释20 小时前
关于comfyui的mmaudio音频生成插件时时间不一致问题(四)(video upload)(解决方法)
开发语言·python·ai作画·音视频·comfyui
干啥啥不行,秃头第一名20 小时前
C++与机器学习框架
开发语言·c++·算法
2301_7765087220 小时前
用Python和Twilio构建短信通知系统
jvm·数据库·python
hongtianzai20 小时前
Laravel7.x十大核心特性解析
java·c语言·开发语言·golang·php
紫丁香20 小时前
pytest_自动化测试5
python·功能测试·单元测试·集成测试·pytest
永远睡不够的入20 小时前
C++庖丁解牛:深入理解多态:从虚函数表到底层实现
开发语言·c++
姚青&20 小时前
Pytest fixture 参数化(params 参数)
开发语言·python·pytest
2301_7938046920 小时前
深入理解Python的if __name__ == ‘__main__‘
jvm·数据库·python