ComfyUI Node

RloadImage

Recover saved node data from a PNG's metadata

By MrFrankHobbidy·Created 6 months ago·Updated 5 months ago· 0
RloadImage
    • output
    image

    Rload solves the "load it back" problem, but a loose .npy file is dead weight - you have to remember it, copy it, keep it paired with the image it belongs to. RloadImage takes a different route: the paired ResourcesSave pack can stuff the numpy payload into the PNG itself as a metadata text chunk, and this node digs it back out.

    You pick the image and out comes output - the saved anything, as a torch tensor with a batch dimension if it was array-shaped. One PNG is both the picture and the data. Drop it into another machine's input folder and you've moved the whole state without a separate file. This is the same "the metadata is the payload" property that makes ComfyUI workflows live inside PNGs, just pointed at arbitrary data instead of the node graph.

    How it works

    The code is small and honest. It opens the PNG, reads a ResourcesSave text chunk from the image info, strips the b'...' repr-style quoting with a regex, base64-decodes it, and runs np.load over the resulting bytes. It also bumps PIL's MAX_TEXT_MEMORY way up so a large payload doesn't fail to parse. The only input is the image picker - a dropdown of images in ComfyUI's input folder with upload enabled, so you can also drop a file straight in. Output is *-typed, named output.

    Install

    Identical to every node in this pack: no dependencies, no models. ComfyUI Manager → search ComfyUI-ResourcesLoad → install → restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MrFrankHobbidy/ComfyUI-ResourcesLoad
    

    Restart and you're done.

    Gotchas, and there are real ones

    • The PNG must have been saved by ResourcesSave. A plain ComfyUI PNG won't have that chunk, and the metadata lookup blows up. The flow is always save-with-ResourcesSave → load-with-RloadImage.
    • Anything that re-encodes the image kills the data. Screenshot it, convert to JPEG, re-save through an editor, upload to a host that recompresses - the chunk is gone and so is your payload. This is the same strip-risk that plagues embedded ComfyUI workflows, which is why the README's advice effectively amounts to "keep the original file." Treat RloadImage as a workflow-state container, not a shareable preview.
    • The upload size limit. The README calls this out explicitly: ComfyUI's default max upload is 100 MB (--max-upload-size 100). An image batch saved as npy can sail past that. Start ComfyUI with a bigger cap:
    python main.py --max-upload-size 2048   # 2 GB, in MB
    

    Beyond that, expect the same FileNotFoundError-style confusion as the rest of the pack if you pick a PNG that never had data written into it.

    CategoryResourcesLoad

    Inputs (1)

    NameTypeDefaultDescription
    imageCOMBO1 options: example.png

    Outputs (1)

    NameTypeDescription
    output*