ComfyUI Node

Tomato Crypt

Hide an image in plain sight — and get it back

By lihaoyun6·Created 2 months ago·Updated 2 months ago· 2
Tomato Crypt
  • image
  • IMAGE
modeencrypt
versionv3
password
language_codeen

Tomato Crypt is the node version of a web tool that's been popular in Chinese social-image circles for a while: it scrambles an image's pixels so it looks like useless noise, then unscrambles it back - provided you have the password. The use case is posting art somewhere that compresses, crops, or snoops on previews (WeChat, Discord thumbnails, forum image hosts) without giving away what the full-res image actually is. The viewer who has the password runs it through the decrypt side and gets the real thing. If that sounds niche, it is - but it's a genuinely neat party trick for a workflow, and the implementation is smarter than the one-liner it looks like.

Call it what it is, though: "crypt" is a stretch. This is pixel scrambling, not encryption. Every pixel gets shuffled along a space-filling curve (a Gilbert curve, a close cousin of the Hilbert one), and the shuffle is keyed by your password. Since the password is at most 4 digits, there are 10,000 permutations - this stops casual eyeballing and platform auto-processing, not a motivated adversary. Don't put anything you'd need a warrant to protect in here. The README and the original web tool are upfront that it's obfuscation, and it works fine for that.

What you actually set

The node takes one image (or a batch - it handles a full tensor) and returns one image. Three inputs matter, and two of them you'll barely touch:

  • mode - encrypt or decrypt. Defaults to encrypt.
  • version - v3 (default) or legacy. Use v3. Legacy just does the bare scramble; v3 embeds a barcode strip at the bottom that records the original width/height and self-heals the pixels the strip destroys. That's what makes it survive being rescaled by a social platform. Decrypt auto-detects v3 and silently falls back to legacy if there's no barcode, so you don't need to think about it much.
  • password - must be exactly four digits, or the node throws a ValueError. Leave it empty and it silently uses 0000. The first two digits set the permutation step, the last two add a little padding. There's also a language_code input (default en); set it to something starting with zh and the banner text renders in Chinese. The banner, by the way, is part of the v3 output - a white strip up top telling people to decrypt.

How the output looks

An encrypted v3 image is the original with a banner on top and a red/blue-anchored barcode strip on the bottom, so it's taller than the input. Don't panic - that's correct. Decrypt reads the barcode, and if the image was resized somewhere along the way it re-samples back to the original dimensions before unscrambling, then trims the chrome and hands you the clean image. If it was resized, you'll get a banner in the output warning you to use the full-res original for best results.

Install

One dependency, and it's a doozy: numba, which the node uses to JIT-compile the curve math (the scrambling would be painfully slow in pure Python). Install via ComfyUI Manager (search "TomatoCrypt") or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/lihaoyun6/ComfyUI-TomatoCrypt.git
python -m pip install -r ComfyUI-TomatoCrypt/requirements.txt

Then restart ComfyUI. No model files, no API keys, nothing else to fetch.

Where people get burned

  • Numba is finicky. It pins specific numpy versions, and ComfyUI's Python env is shared with everything else - pip install numba can quietly bump or break numpy for other nodes. If you hit import errors elsewhere after installing, that's the usual suspect. Prefer installing into ComfyUI's own venv and don't force --upgrade numpy.
  • First run is slow. Numba compiles its kernels on first use, so the first encrypt/decrypt can stall for several seconds. It's cached after that.
  • Wrong password length = hard error, not a gentle message. Four digits only.
  • The scramble is lossless-ish on the raw output, but if you save the encrypted image to JPEG with heavy compression, decrypt quality drops - v3's self-heal and resize handling cover a lot, not everything.

The author (lihaoyun6) is the same person behind the FlashVSR ultra-fast video upscaler that got real community traction, so this isn't a sketchy one-off - just a very specialized toy. If your gallery workflow needs to share images without sharing the image, it's the only node I know that does exactly this.

Categoryimage

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
modeCOMBOencrypt2 options: encrypt, decrypt
versionCOMBOv32 options: v3, legacy
passwordSTRING
language_codeSTRINGen

Outputs (1)

NameTypeDescription
IMAGEIMAGE