Nodes/ComfyUI-Cyber-Steganography/Stego Encode (Hide Text)
ComfyUI Node

Stego Encode (Hide Text)

Bury a Secret Message in an Image's Pixels

By sjhddh·Created 7 months ago·Updated 7 months ago· 0
Stego Encode (Hide Text)
  • image
  • IMAGE
textSecret Message
key

Stego Encode takes any image and writes a secret text message into its pixels - invisibly. The image looks exactly the same to you, but somewhere in the last bits of the red, green, and blue channels sits your message, readable only by the matching Stego Decode node. It's a "Digital Watermarking / Secret Comm Channel" for agents operating in the latent space, as the pack author gleefully puts it. The name is the pitch: hide in plain sight.

Why would you reach for this? ComfyUI already tucks your whole workflow into PNG metadata, so you can share an image and have the graph come back with it. The catch is that Discord, Twitter, and half the image hosts on the internet strip that metadata on upload. LSB steganography doesn't live in metadata - it lives in the pixel values - so the message survives sites that scrub EXIF and workflow tags, as long as the image isn't recompressed along the way. People have been using exactly this trick since the earliest stego threads on r/comfyui. It's also a genuinely fun way to sneak an easter egg or a prompt into an image you're posting.

How it works

This is classic Least Significant Bit steganography, implemented in pure Python (numpy + Pillow, both already inside ComfyUI). The node flattens the image into one long list of RGB byte values and rewrites the last bit of each one: a 0 stays even, a 1 goes odd. Your text becomes UTF-8 bytes, then bits, prefixed by a 32-bit length header so the decoder knows how much to read. Because each pixel has three channels, capacity is roughly width × height × 3 bits - a 1024×1024 image can swallow a couple of hundred bytes of text, and the message starts in the top rows. Give it a key and it XOR-encrypts the bytes first, which is a toy cipher, not security. The README says so itself: educational and artistic, not military-grade. Treat it as a "don't read this without knowing the key" lock, not an encryption layer.

The inputs that matter

  • image (required) - the IMAGE you generated or loaded. Each frame of a batch gets the same message embedded.
  • text (required, multiline) - your secret. Defaults to "Secret Message" if you forget to change it, so change it.
  • key (optional) - the XOR password. Leave blank for no encryption, and remember: whoever decodes needs the exact same key.

The single output is an IMAGE, which you wire into a Save Image node. Save as PNG - always.

Installing it

ComfyUI Manager is the easy path: search "ComfyUI-Cyber-Steganography" and install. Or do it by hand:

cd ComfyUI/custom_nodes/
git clone https://github.com/sjhddh/ComfyUI-Cyber-Steganography

Then restart ComfyUI. That's it - there are no model files, no requirements.txt, no hidden downloads. In an ecosystem where half of every install is dependency hell, a pack that runs on what ComfyUI already ships is a small relief.

Where people get burned

The big one: this only survives lossless formats. JPEG, resizing, upscaling, or running the image back through a VAE re-encode scrambles the LSBs and the message is gone forever. Save PNG, and don't edit the file after the fact. Second trap is quieter: if your text is too long for the image, Stego Encode prints an error to the ComfyUI console and silently hands you back the original, unencoded image - no popup, no red node. You'll post a picture with no secret in it and never know. Always verify by running the output through Stego Decode before you send it anywhere.

CategoryCyberSteganography

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
textSTRINGSecret Message
keyoptSTRING

Outputs (1)

NameTypeDescription
IMAGEIMAGE