Encrypt and Save Image (Optimized)
It 'encrypts' your images — but the recipe rides along in the file
- images
You're generating on a machine that isn't yours - a Kaggle notebook, a rented GPU box, some shared cluster - and an automated scanner keeps flagging anything that looks AI-generated. That's the exact situation this node was built for. It saves your image as a password-keyed scramble that reads as static to a detector but can be put back together later with the companion tool. It's the "keep the platform's eyes off my output" node.
The name oversells it a bit. "Encrypt and Save Image (Optimized)" is really pixel-level scrambling, not cryptography. But for dodging a scanner that's only checking whether an image looks generated, scrambling is precisely the right tool - and worth knowing what you're actually getting.
How it works
The node takes your IMAGE tensor, converts it to a PIL image, and cuts it into square blocks. Those blocks get shuffled into a pseudorandom arrangement and each one gets its colors mangled - channel swaps, inversions, that sort of thing. The whole scramble is keyed by your password: it hashes the password, seeds Python's RNGs with that value, so the same password always reproduces the same scramble.
Here's the part that tells you how serious this is: the block mapping is written straight into the PNG's text metadata (block_mapping, plus encryption_method: custom_block_shuffle_v1). Your full workflow JSON rides along too, as prompt and extra_pnginfo text chunks, just like a normal Save Image node does. The file literally carries the recipe for undoing itself.
The honest take
Because the mapping is stored inside the file, anyone who knows the format can un-scramble your image without ever learning your password. This isn't protecting pixels from a human - it's defeating an automated detector too lazy to reverse a shuffle. Which is fine! That's exactly the author's stated purpose (the README talks about avoiding "误伤" - accidental flagging - by detection programs on public platforms like Kaggle). Just don't treat it as security for anything you'd actually want secret.
Inputs and outputs
Only four inputs, and you really only set two:
- images - your IMAGE tensor. Batches work; every frame gets scrambled and saved separately.
- password - the seed. Default is
123, so change it. Same password in, same scramble out - this is your key to restoring the image. - block_size - the side length in pixels of the shuffle blocks (default 64, range 8–256 in steps of 8). Smaller means a finer, more thorough scramble; larger means chunkier blocks and faster processing.
- filename_prefix - prefix for the output files, default
ComfyUI_Encrypted.
There are no data outputs - this is an output node, the terminal point of a graph. It writes ComfyUI_Encrypted_00001_.png into your ComfyUI/output folder and returns UI results so the file shows up in your queue history.
Installing it
Easiest via ComfyUI Manager - search for comfyui-EncryptSave (the pack title) and hit install. Or the manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/chou18194766xx/comfyui-EncryptSave
Then restart ComfyUI. No model downloads, no heavy dependencies for this node - it's plain numpy + PIL. The README's pip install pycryptodome step is for the AES variant below, not this one.
Gotchas
- The pack moved on. Current
mainships a rewritten AES-256-CBC node ("Encrypt and Save (AES)") with a real decrypt program linked in the README. That one is actual cryptography and it does need pycryptodome. So after installing you may find a different, stronger node than the one described here - same family, same inputs. If it errors about pycryptodome, that's the README's install step catching up with you. - An empty password prints an error and skips the save entirely. Don't leave it blank, and don't leave it
123if you care. - Images smaller than the block size fall back to a bare channel inversion - barely disguised at all.
- Same rule as every custom node: the code runs with your user's permissions when ComfyUI loads it, no sandbox. This one's ~250 lines of plain numpy/PIL - easy enough to skim yourself before trusting it on a machine you don't own.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| password | STRING | 123 | — |
| block_size | INT | 648–256 | — |
| filename_prefix | STRING | ComfyUI_Encrypted | — |
Outputs (0)
No outputs