ZML_小番茄混淆
Scramble pixels with a space-filling curve — ZML_小番茄混淆
- 加密
- 解密
- 加密
- 解密
ZML_小番茄混淆 - the "small tomato obfuscation" node - is a pixel scrambler. Feed it an image and it rearranges the pixels along a space-filling curve so the result looks like static noise; feed the scrambled result back into its 解密 input and it puts the pixels back exactly. It's image obfuscation for people who want to share a composition without sharing the composition.
The mechanism is genuinely interesting, so let's look at it. The node builds a Gilbert curve - a 2D space-filling curve that visits every pixel exactly once in a snake-like path - then shifts the pixel order along that curve by a golden-ratio-derived offset ((√5 − 1)/2 × total pixels). Encryption permutes pixels into the shifted positions; decryption is the exact inverse permutation. Since the offset depends only on image dimensions, any image of the same size encrypts and decrypts cleanly. No key, no cryptography - it's a permutation cipher on pixels, which is exactly the honest description.
Both 加密 and 解密 are optional IMAGE inputs, and both outputs are IMAGE (named 加密 and 解密). You can run it in either direction: wire a source into 加密 and read the scrambled 加密 output, or wire scrambled art into 解密 and get the original back. It processes whole batches, one image at a time, on CPU (numpy) - fine for a few images, slow for a big batch.
Where's this actually useful? Three places. Obscuring a WIP so you can post it without leaking the actual image; testing whether an image survives round-tripping (encrypt → save → load → decrypt); and as a puzzle. The README says the author found the concept floating around open-source projects and re-implemented it for the pack - "Tomato" is the running gag name, not a product. It's a toy with a real niche, not a security tool. Don't use it to protect anything that matters: the permutation is deterministic and reversible by anyone with the code.
Installing it
Ships in ComfyUI-ZML-Image. ComfyUI Manager → ComfyUI-ZML-Image, or:
cd ComfyUI/custom_nodes
git clone https://github.com/zml-w/ComfyUI-ZML-Image
Restart. Depends only on numpy/torch, both already in ComfyUI. Chinese UI; English patch at https://github.com/zml-w/ZZZ_ZML_English_Patch.
Common issues
The big one is a surprise to nobody who read this far: it's not encryption. The README's own history shows the author is aware - the update that added it says the original author is "not really known" and it was re-made "to be more convenient to use." If you save a scrambled image, re-encode it (JPEG), or crop it, decryption silently fails or produces garbage, because the permutation is tied to exact pixel positions. Lossless PNG only. And the two input sockets work independently - if you plug an image into 加密 and read from 解密, you get an empty 1×1 placeholder, which is easy to trip over.
Also expect the honest truth about polish: this is the kind of novelty node a solo dev adds for fun, and the "small tomato" name plus a lack of any key mechanism tells you it's not a serious privacy primitive. Use it for obfuscation-in-jest and workflow theatrics; reach for real encryption (the pack also ships a ZML_图像加密 node, which is a different beast) if you actually need privacy.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| 加密opt | IMAGE | — | |
| 解密opt | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| 加密 | IMAGE | — |
| 解密 | IMAGE | — |