ComfyUI Node

Image to WEBP

Export WebP Without Throwing Away the Workflow

By Ye0l·Created 2 months ago·Updated about a month ago· 0
Image to WEBP
  • image
  • webp
quality95
method6
losslessfalse
embed_metadatatrue
include_prompt_metadatatrue
include_workflow_metadatatrue
metadata_json{}
filename_prefixcomfyui

The usual ComfyUI save path is PNG, because the PNG carries your whole workflow in its chunks - drag it back onto the canvas and the graph rebuilds. The problem is PNGs are fat, and if you're sending renders anywhere (Telegram, a photo server), you either eat the size or recompress and lose the metadata. Image to WEBP is the middle path: a WebP encode that keeps the workflow alive. It mirrors ComfyUI's own metadata convention, so the webp file you get back out of Telegram or Immich can be dragged into ComfyUI and it restores the prompt and node graph just like a PNG would.

How it works

It takes an IMAGE batch, converts each tensor to PIL, and saves it as WebP with the settings you give it. What makes it different from a plain "encode to webp" node is the EXIF step: when embed_metadata is on, it writes the prompt and workflow JSON into the file's EXIF (0th IFD, formatted as key:json_value) using the same scheme ComfyUI itself uses for WebP/JPEG. Toggle include_prompt_metadata and include_workflow_metadata individually if you want one without the other, and metadata_json lets you stuff in your own custom JSON alongside.

The inputs that matter

  • quality - 1 to 100, default 95. For sharing, 95 is plenty; for archival you might bump it.
  • method - 0 to 6, default 6. This is the compression effort slider: 6 gives the smallest file but takes the longest. While iterating, dropping to 3–4 is a free speedup.
  • lossless - default off. Lossy at quality 95 is visually indistinguishable for renders and a fraction of the size.
  • embed_metadata - default on. Turn it off if you want a clean file with no workflow in it.
  • filename_prefix - default comfyui; each image in a batch becomes comfyui_1.webp, comfyui_2.webp, etc.

Output is a single webp output of type WEBP. And here's the thing to know: that WEBP type is this pack's own convention - a small dict holding the bytes, the filename, the MIME type and the metadata, not a standard ComfyUI type. You can't feed it into SaveImage or anything else stock. It's designed to flow straight into the two sibling nodes in the same pack, Send WEBP to Telegram and POST WEBP to Immich. That's the intended chain: VAE decode → Image to WEBP → send.

Install

Ships in Ye0l/ComfyUI-KSTR-Nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/Ye0l/ComfyUI-KSTR-Nodes

or search "ComfyUI-KSTR-Nodes" in ComfyUI Manager. It depends on piexif (for the EXIF writing) and requests, which are in the pack's requirements.txt - Manager installs those automatically; if you cloned by hand, run pip install -r requirements.txt in the node folder first, then restart.

Where people get burned

Metadata only survives if the destination keeps your original bytes. Sending the webp to Telegram as an inline photo recompresses it and the workflow is gone; sending it as a document preserves the file, so that's the setting that keeps the drag-back-to-recover trick working. And don't fight the pack-local WEBP type - if you need a file on disk too, run a stock SaveImage in parallel. Otherwise this is one of those quiet utility nodes that just works: encode, embed, ship.

CategoryYeol/Image

Inputs (9)

NameTypeDefaultDescription
imageIMAGE
qualityINT951–100
methodINT60–6
losslessBOOLEANfalse
embed_metadataBOOLEANtrue
include_prompt_metadataBOOLEANtrue
include_workflow_metadataBOOLEANtrue
metadata_jsonSTRING{}
filename_prefixSTRINGcomfyui

Outputs (1)

NameTypeDescription
webpWEBP