Nodes/ComfyUI-Image-Cipher/πŸ”“ Cipher Decode (Preview)
ComfyUI Node

πŸ”“ Cipher Decode (Preview)

Get Your Scrambled Image Back β€” Cipher Decode, Explained

By engineer6980Β·Created 7 months agoΒ·Updated 7 months agoΒ· 2
πŸ”“ Cipher Decode (Preview)
  • images
  • restored_image

This node is the other half of a very small coin, and it's the honest half. Where the encode node scrambles an image into color static, this one unscrambles it - feed it the noise and you get the original back, pixel for pixel. The name says it all, actually: the UI labels it "(Preview)" and the pack's README is explicit that it exists "only to verify the restore result inside ComfyUI or for debugging." It's a sanity-check node, and that's a fine thing to be.

Why you'd reach for it

Two genuinely useful jobs. First, the debug loop: wire Encode β†’ Save Image, load that PNG back in, run Decode, and confirm the pixels match what you started with. It's a satisfying five-second proof that the "lossless" claim holds. Second, the privacy workflow this pack was actually built around: run the encode on a remote/API workflow so the stored output is static, download it, then restore locally with this node instead of fumbling with the pack's Python helper script. Same result, zero code.

Just keep expectations honest. Since this is exact inverse math, there are no "close" results - either you feed it the same dimensions and channel order the encode used and it's perfect, or you don't and it's garbage. There's no in-between, and no denoising to rescue you.

How it works

It's the precise inverse of the encode. Same fixed key, same formulas - for each row, red rolls back by (row * 999 * 1) % width, green by (row * 999 * 2) % width, blue by (row * 999 * 3) % width - just in the opposite direction. Because the encode used circular shifts (torch.roll, where pixels wrap around the edge instead of falling off), nothing was ever dropped, so reversing it restores the original perfectly. No inference, no guessing, no model. It's linear algebra on pixel positions, done in a couple of milliseconds.

One honest caveat: "Cipher" is doing a lot of work in this pack's name. The key is 999, hardcoded in public source, and this decode node ships right next to the encode. So anyone who can install the pack can reverse whatever you've obfuscated. This is cosmetic privacy - hide the image from a casual glance at a server's preview - not anything you'd want protecting real secrets.

Inputs and outputs

Boring in the best way:

  • images (IMAGE, required): the cipher image - color static straight from ImageCipherEncode, or loaded from a saved PNG. Batches are handled fine.
  • Output restored_image (IMAGE): the restored image, identical to the pre-encode original. Wire it to Save Image or a preview, or straight into anything downstream that wants an IMAGE.

Install

Shared with its encode sibling - same pack, same two lines:

cd ComfyUI/custom_nodes
git clone https://github.com/engineer6980/ComfyUI-Image-Cipher

Or ComfyUI Manager β†’ search "Image-Cipher". Dependencies are torch and numpy, both already in any ComfyUI install, and there are no model downloads. Restart, and both nodes live under CipherTools.

Common issues

Resize the cipher PNG and the restore silently breaks - the shifts are width-dependent, full stop, and there's no error message to warn you, just wrong-looking output. Same story if you re-encode through a VAE or change dimensions in any way. Keep the noise PNG untouched from save to decode. And since the key is fixed and public, remember the ceiling on this whole scheme: it hides content from a glance, not from anyone who cares to look.

CategoryCipherTools

Inputs (1)

NameTypeDefaultDescription
imagesIMAGEβ€”

Outputs (1)

NameTypeDescription
restored_imageIMAGEβ€”