ComfyUI Node

HTTP Form Image Item

POST a generated image straight from the latent → VAE pipeline

By wawahuy·Created about a year ago·Updated 11 months ago· 14
HTTP Form Image Item
  • image
  • form_item
nameimage
filenameimage.png
formatPNG
quality95

This is the node that makes the whole pack worth installing. HTTP Form Image Item takes a ComfyUI IMAGE tensor - the thing that comes out of VAE Decode - and encodes it in memory into PNG, JPEG, or WEBP bytes, packaged as a file item for a multipart form. No saving to disk, no base64 gymnastics, no "upload the file to your server first" dance. The image you just generated is in the POST request.

It's the missing link between "I made an image in ComfyUI" and "my external API needs that image."

How it works

Two required inputs:

  • name - the form field name (defaults to image).
  • image - the IMAGE tensor. Feed it from VAE Decode (or Load Image, or anything else outputting an IMAGE).

Then the optional controls that matter:

  • format - PNG (default), JPEG, or WEBP. PNG for lossless; JPEG/WEBP if the API cares about size and quality.
  • quality (default 95) - applies to JPEG and WEBP. Lower it to shrink the payload.
  • filename (default image.png) - what the server sees as the file name; change the extension to match your format or some servers complain.

Internally it converts the tensor to a PIL image (handling batch and channel order correctly), re-encodes it to bytes with the format/quality you picked, and attaches the right content type (image/png, image/jpeg, image/webp). If you feed it a batch of images, it takes the first frame - so split batches upstream if you want to upload each one.

One output: form_item (HTTP_FORM_ITEM), which goes into an HTTP Form Data slot, then into HTTPPost with content_type = form-data.

The classic combo

[KSampler → VAE Decode] → [HTTP Form Image Item] ──┐
                                                     ├→ [HTTP Form Data] → [HTTP Post: form-data]
[prompt → CLIP encode → text] → [HTTP Form Text Item] ┘

One request carrying your rendered image and its prompt/caption to whatever service wants them.

Install

ComfyUI Manager → search "ComfyUI-HTTP" → Install, restart. Manual:

cd ComfyUI/custom_nodes/
git clone https://github.com/wawahuy/ComfyUI-HTTP.git
cd ComfyUI-HTTP
pip install -r requirements.txt

No model downloads. It needs Pillow, which any working ComfyUI install already has.

Where people get burned

If encoding fails for any reason, the node doesn't raise - it silently degrades into a text form item containing Error: .... Your upload "succeeds" but the API gets a string where it expected image bytes. Also watch filename vs format: JPEG data named image.png confuses picky servers. And the "first frame of a batch" behavior will quietly surprise you if you upload from a batched generation - you'll send one image and wonder where the other three went.

CategoryHTTP/Form Data

Inputs (5)

NameTypeDefaultDescription
nameSTRINGimage
imageIMAGE
filenameoptSTRINGimage.png
formatoptCOMBOPNG3 options: PNG, JPEG, WEBP
qualityoptINT951–100

Outputs (1)

NameTypeDescription
form_itemHTTP_FORM_ITEM