RsaveImageC
Re-encode images to webp/jpg/png bytes in memory — the codec node before the save
- images
- output
RsaveImageC is the least talked-about node in this pack and the one that makes the other two flexible. It takes an image batch, re-encodes every frame to the format you pick, and hands back the raw encoded bytes as in-memory file objects. No file is written, nothing is saved to disk - it's the node before the save, and it exists to give you control over how pixels get stored before something else stores them.
The "C" is for codec, and that's the whole job. In the author's example workflow it encodes images to webp bytes and feeds Rsave, so the .npy file that lands on disk contains compact encoded images instead of raw float32 tensors. That's a huge size difference - a webp of an image is often a fraction of the size of its uncompressed tensor, which matters when you're stashing batches in .npy files or embedding them in PNG metadata via RsaveImage. If you've ever saved a latent dump and watched the file size balloon, this is the fix: encode first, then store.
What you set
Two inputs, and that's it:
images- the IMAGE batch. A single image works fine; a batch of twenty gets encoded one frame at a time, and you get one encoded buffer per frame.iformat- a dropdown:webp,jpg, orpng. All three are encoded at maximum quality (webp and jpg at quality 100, png at compress level 6), so you're not trading quality for size here - the point is the container, not the compression knob.
The output - read this before wiring it up
The output socket is typed * (any), and what actually comes out is a Python list of BytesIO file-like objects - one per image in the batch, each holding the encoded bytes. That is not an image. Wire it into anything expecting IMAGE and you'll get nothing sensible, because ComfyUI won't type-check a wildcard socket to warn you. This output is meant for nodes that accept raw file bytes: Rsave (to persist them), RsaveImage (to embed them in metadata), or a custom save node that understands file-like objects.
Second gotcha, the flip side of "nothing is written": because the encoding lives only in memory, if nothing downstream persists those bytes, they evaporate when the run ends. The node is a transform, not a destination - always pair it with something that actually saves. Third, don't feed it huge batches expecting speed; it's pure-Python Pillow encoding per frame, so it's not the bottleneck in most workflows, but it's also not fast.
Install
Same pack, no surprises:
cd ComfyUI/custom_nodes
git clone https://github.com/MrFrankHobbidy/ComfyUI-ResourcesSave
or ComfyUI Manager, search ComfyUI-ResourcesSave, then restart. No extra dependencies - Pillow is already in ComfyUI's runtime. The node sits under ResourcesSave. Reach for it when you want the bytes of an image in a specific format without ever writing an intermediate file, and remember: encode, then hand off to something that saves.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| iformat | COMBO | 3 options: webp, jpg, png |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output | * | — |