ZML_图像加密
The 'encryption' that's really a puzzle — and knows it
- 加密
- 解密
- 加密
- 解密
ZML_ImageEncryption (ZML_图像加密) is a great example of why you should read what a node actually does before you trust the word "encryption." Feed it an image, pick a password, and it scrambles the pixels into noise. Feed the noise back with the same password and you get the original. That's the pitch - but the mechanism matters, because it's obfuscation, not cryptography, and the difference decides what it's safe to use for.
It ships in ComfyUI-ZML-Image, zml-w's big utility pack (added in a September 2025 update alongside a watermark node). It sits in the pack's tools subcategory.
How it works
Block-shuffle encryption. The node center-crops your image so its dimensions divide evenly by the block size, slices it into a grid of small rectangles, then shuffles those blocks into a new arrangement and pastes them back together. The "secret" is that the shuffle order comes from a random generator seeded with your password, so the same password always produces the same scramble - and running the same node again on the scrambled image with that password un-shuffles it.
The 切割数 (split count) parameter is the block size: 4, 8, 16, 32, 64, 128 are the recommended values. Smaller blocks = finer, noisier scramble; bigger blocks = chunkier, more obviously "rearranged image" pixels.
The honest take
This is a permutation cipher. It's completely deterministic - anyone with the source code, which is public on GitHub, can reverse it if they can guess or brute-force the password. It will stop a person who glances at the file and sees noise. It will not stop anyone who knows what they're doing. Treat it like a privacy screen for casual files, not like a vault.
Inputs and outputs
- 密码 (password) - the seed. Default is a phrase; change it, and remember it, because a wrong password gives you a different scramble you can't undo.
- 切割数 - block size, as above.
- 加密 and 解密 inputs - the two optional IMAGE sockets. Feed an original to 加密 to scramble it; feed a scrambled image to 解密 to restore it. Same node, two jobs.
- Outputs mirror them: 加密 (the scrambled image) and 解密 (the restored image), both IMAGE.
Installing it
Standard pack install:
cd ComfyUI/custom_nodes
git clone https://github.com/zml-w/ComfyUI-ZML-Image
restart ComfyUI, or install via ComfyUI Manager by searching "ComfyUI-ZML-Image". The pack's requirements (OpenCV, scipy, ultralytics, etc.) are heavy on first install but this node itself needs no model downloads and no extra setup.
Where people get burned
The default password is literally a Chinese phrase meaning "in my dreams" - everyone who installs the pack has it. Change it if you're scrambling anything you'd care about. And if you change 切割数 between encrypt and decrypt, the blocks won't line up and you can't get the original back. Same password, same 切割数, every time.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| 密码 | STRING | 在梦里w | — |
| 切割数 | INT | 164–128 | 推荐值为4、8、16、32、64、128 |
| 加密opt | IMAGE | — | |
| 解密opt | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| 加密 | IMAGE | — |
| 解密 | IMAGE | — |