Nodes/Save Uncompressed 16 Bit PNG/Save Image RGBA 16 PNG
ComfyUI Node

Save Image RGBA 16 PNG

16-bit PNGs Out of ComfyUI, Without the Banding

By yolanother·Created 2 years ago·Updated 2 years ago· 4
Save Image RGBA 16 PNG
  • images
    filename_prefixComfyUI_EXR

    Your default SaveImage is quietly lying to you. It writes 8-bit PNGs, which is fine for sharing a meme but not when a big flat gradient runs through curves or exposure in an editor and bands like a barcode. ComfyUI does all its math in 32-bit float, so the precision is there - it just gets thrown away at the save step. Save Image RGBA 16 PNG (SaveImageARGB16PNG) is the small node that keeps it: it writes an uncompressed 16-bit-per-channel PNG so the tones you rendered are the tones you get.

    It's a genuinely narrow tool. There's exactly one node in the pack, it takes an image and a filename, and it's an output node - it saves a file, nothing else. You reach for it when the render is going somewhere that cares about bit depth: print, HDR-ish mattes, heavy post-processing, or a pipeline that re-feeds the result through another model and you don't want a second generation's worth of 8-bit error baked in.

    How it works

    The mechanism is almost embarrassingly simple, and that's the point. It takes your IMAGE tensor (floats in roughly 0–1, the same values ComfyUI has been carrying all along), multiplies by 65535, casts to uint16, tacks on a fully-opaque alpha channel, and hands it to OpenCV's PNG writer. OpenCV writes real 16-bit PNGs, so you get 65,536 levels per channel instead of 256. No API calls, no model downloads, no resolution tricks - just a wider integer.

    One thing worth knowing before you trust it with weird numbers: it doesn't clamp. If a node upstream hands it values below 0 or above 1, the cast wraps and truncates and you get noise. Keep the tensor in 0–1 and you're fine.

    The two inputs that matter

    That's genuinely all there is - required inputs are images and filename_prefix. It also quietly accepts ComfyUI's standard hidden prompt and extra_pnginfo, which I'll come back to.

    • images - the tensor to save. Wire whatever you'd normally feed SaveImage.
    • filename_prefix - the filename base, and the one you'll actually touch. It supports ComfyUI's dynamic formatting like %date:yyyy-MM-dd% or %Empty Latent Image.width%. Change the default. It ships as ComfyUI_EXR - a copy-paste leftover from the EXR save code this pack was forked from, and every file you save gets that name.

    Files land in the same ComfyUI/output directory as the stock node, with the usual counter suffix.

    Installing it

    Same drill as every custom node. In ComfyUI Manager, search "Save Uncompressed 16 Bit PNG" and hit install. Or, if you don't use Manager:

    cd ComfyUI/custom_nodes
    git clone https://github.com/yolanother/ComfyUI-Save16bitPng
    

    Then restart ComfyUI. No models to fetch, and the heavy dependencies are the usual suspects: numpy and OpenCV (cv2), which you almost certainly already have from other nodes.

    The gotchas

    This pack is small enough that the rough edges are visible, so here's the honest tour.

    The README lies about metadata. It promises prompts and PNG info embedded in the file. The shipped code doesn't write any - the prompt and extra_pnginfo inputs are accepted and then ignored, and OpenCV's writer isn't given metadata. If you need your workflow embedded in the PNG, use the stock SaveImage or a dedicated metadata node instead.

    The node description lies about the format. The on-the-registry description says it saves EXR files. It saves PNG. Trust the README and the code, not the description.

    The dependency list is stale. requirements.txt still lists OpenEXR and Imath, but the last commit is literally "Finish removing openexr dep" - the code imports cv2, not OpenEXR. So pip will install two pointless packages, and if you're missing OpenCV the import fails on startup regardless. Annoying, harmless, and easy to be confused by.

    And the honest caveat about the whole idea: 16-bit PNGs are roughly twice the size of 8-bit ones, and for the flat-shaded cartoon renders most people make, you'll never see the difference. Save this node for the jobs that actually push gradients around - then it's the difference between smooth and stripes.

    Categoryimage

    Inputs (2)

    NameTypeDefaultDescription
    imagesIMAGEThe images to save.
    filename_prefixSTRINGComfyUI_EXRThe prefix for the file to save. This may include formatting information such as %date:yyyy-MM-dd% or %Empty Latent Image.width% to include values from nodes.

    Outputs (0)

    No outputs