Nodes/comfyui_EncryptPreview/Encrypt Preview Image (No File)
ComfyUI Node

Encrypt Preview Image (No File)

See your image without ever writing a file to disk (and no, it's not real encryption)

By chou18194766xx·Created about a year ago·Updated about a year ago· 3
Encrypt Preview Image (No File)
  • images

    The whole point of this node is in its Chinese one-liner README: 非落地图片预览 - a non-landing image preview. Wire your finished image into EncryptPreviewImage and you get a full preview in the ComfyUI UI, and the file never touches disk. Not the output folder, not a temp cache, nowhere. If you run ComfyUI on a rented or shared box where you don't want your generations lingering on a filesystem that isn't yours, that one property is the entire selling point.

    What "Encrypt" means here (spoiler: not encryption)

    Here's the honest part before you get invested: the preview node itself does not encrypt anything. It base64-encodes the image, which is encoding, not encryption - anyone can decode base64 with a browser. The "Encrypt" in the family name comes from the sibling node this pack is designed to pair with, comfyui-EncryptSave, which does real encryption (via pycryptodome) before saving. The author's framing is that this is for dodging automated disk scanners on public GPU platforms like Kaggle - the classic "my notebook got flagged" problem. Preview without leaving evidence, save an actually-encrypted copy, and decrypt on your own machine with their standalone tool. If you don't care about any of that, the built-in PreviewImage node does the same "look at my image" job without the theatrical name.

    How it works

    The mechanism is dead simple and it's all in encrypt_preview.py. For every image in the incoming batch tensor, it converts to a uint8 numpy array, encodes it as a PNG in memory (no save() call anywhere), base64-encodes the bytes, and ships them back over ComfyUI's websocket as a ui message. A bundled frontend extension (js/encryptPreview.js) then renders those base64 strings directly on the node - a single image gets centered, a batch gets laid out in a scrollable grid. Click a thumbnail for a fullscreen modal; click the modal to open the image in a new tab.

    So the image lives in RAM and in your browser's memory as a data: URI, and nowhere else. That's the entire trick, and it's worth respecting how well it holds up: the Python side genuinely never writes a file.

    Inputs and outputs

    There's exactly one input that matters:

    • images (IMAGE) - the image or batch you want to preview. The tooltip is the author's own description: "The images to preview without saving." It's a terminal node: OUTPUT_NODE is true, it returns no outputs, so it must be the last stop on that branch. Feed it the tensor from a VAE Decode (or from anything else that outputs an IMAGE) and it displays whatever arrives.

    Two hidden inputs (prompt and extra_pnginfo) exist in the code but you'll never touch them - they're for metadata plumbing and do nothing visible here.

    Install

    The pack has no requirements.txt and adds zero dependencies - it only uses torch, numpy, and PIL, all of which ComfyUI already ships. So installation is the boring two-step:

    cd ComfyUI/custom_nodes
    git clone https://github.com/chou18194766xx/comfyui_EncryptPreview
    

    Then restart ComfyUI. Or, if you use ComfyUI Manager, search for comfyui_EncryptPreview (it also shows under the display name "Encrypt Preview Image") and install from there. Note: if you also grab the companion EncryptSave node, that one needs pip install pycryptodome - don't install it for this preview node, it doesn't use it.

    Caveats and troubleshooting

    • No visible widget after install? The preview is drawn by the JS extension. If you don't fully restart ComfyUI after cloning (not just reload the page), the extension won't register and the node renders as an empty box. Restart, and give it one run - it starts with a gray "Waiting for preview..." placeholder.
    • Big batches get chatty. Each image is base64'd into the UI message; the author deliberately uses fast PNG compression (compress_level=1), which means bigger bytes, faster encode. A 10-image batch of big renders can make the websocket payload chunky and the grid sluggish. Keep preview batches modest.
    • Quiet failures. Logging is set to WARNING, so a bad input tensor just produces an empty result and the widget says "No preview available." There's a half-hearted type check on images, but a wrong-typed tensor mostly means a silent empty preview - the error only shows in the server console.
    • It's display-only. No outputs means you can't chain onward from it. If you want to both preview and save, branch your image tensor: one wire to this node, one to your save node of choice.
    Categoryimage/preview

    Inputs (1)

    NameTypeDefaultDescription
    imagesIMAGEThe images to preview without saving.

    Outputs (0)

    No outputs