comfyui-stegaflow

comfyui-stegaflow
★ 0

隐写术工作流程嵌入图像元数据ComfyUI节点
通过像素隐写将ComfyUI工作流程数据嵌入图像,保存后可自动从图像恢复工作流程,兼容现有系统并可同时写入PNG元数据。
💡 保存图像时将ComfyUI工作流程嵌入像素,便于分享与恢复
🍴 1 Forks💻 JavaScript🔄 2025-09-30
📦
网盘下载
复制链接后前往夸克网盘下载
https://pan.quark.cn/s/9671236b7e59
📄 README

ComfyUI Stegaflow

A ComfyUI custom node pack that embeds workflow data into image pixels using steganography (LSB encoding), allowing workflows to be recovered from images even if PNG metadata is stripped.

Vibe Coding Disclaimer

This custom node pack was totally vibe coded as a proof-of-concept. I took a glance at the implementation and it’s pretty bad (e.g. creating a giant list of all pixels in the image). But it works!

Features

  • Save Image (Stegaflow) node – Saves images with workflow data embedded in pixels
  • Automatic workflow extraction when loading images with embedded data
  • Compatible with existing ComfyUI workflow system
  • Optional: Can also save to PNG metadata (standard method) simultaneously
  • How It Works

    Encoding (Python)

    The node embeds workflow JSON data into the lowest bit (LSB) of each RGB channel in the image pixels. The data is stored in a clockwise spiral pattern starting from the top-left corner:

  • Top row (left to right)
  • Right column (top to bottom)
  • Bottom row (right to left)
  • Left column (bottom to top)
  • Repeat inward for inner rectangles
  • The data is prefixed with a magic string "ComfyUI\0" to identify images containing embedded workflows.

    Decoding (JavaScript)

    When an image is loaded in ComfyUI, the extension automatically:

  • Reads pixel data from the image
  • Extracts LSBs in the same clockwise spiral pattern
  • Checks for the magic string
  • If found, decodes the workflow JSON and loads it
  • Usage

    Saving Images with Embedded Workflows

  • Add the Save Image (Stegaflow) node to your workflow
  • Connect your image output to it
  • Configure options:
  • filename_prefix: Output filename prefix
  • embed_in_pixels: Enable/disable steganography (default: true)
  • embed_in_metadata: Enable/disable PNG metadata (default: true)
  • Loading Images with Embedded Workflows

    Simply drag and drop a PNG image with embedded workflow data into ComfyUI. The workflow will be automatically extracted and loaded.

    Technical Details

  • Data Capacity: 3 bits per pixel (1 bit each from R, G, B channels)
  • Magic Header: “ComfyUI\0” (8 bytes = 64 bits)
  • Encoding Method: LSB (Least Significant Bit) steganography
  • Pattern: Clockwise spiral from outer edge to center
  • Compatibility: V3 ComfyUI node API format
  • Notes

  • The visual impact on images is minimal (only the LSB is modified)
  • Images must be large enough to store the workflow data
  • Works with PNG images
  • Steganography data survives most image operations but may be lost if images are re-encoded with certain compression methods