Nodes/CometAPI/Comet 图像卡片
ComfyUI Node

Comet 图像卡片

Save an image once, reuse it without re-running upstream

By nkxx188·Created 3 months ago·Updated 3 months ago· 15
Comet 图像卡片
  • image
  • image
  • batch_image
filename_prefixCometAPIImageCard
asset_ref
asset_index0
_batch_image_requiredfalse
_batch_source_node_id

Every API-generation node in this pack costs money per call. So the worst thing you can do is re-run a whole workflow just to get back an image you already generated once. "Comet 图像卡片" is the pack's answer: it saves the image that flows into it as a managed asset, and later runs can pull that saved asset back without touching the expensive upstream node at all.

This is the node that makes the pack's "素材卡片" (asset card) concept real for images. Think of it as a save node with a memory.

How it works

Wire an image tensor in, and the node saves it to your ComfyUI output folder under the pack's cometapi_assets subfolder, using filename_prefix (default CometAPIImageCard) for the name. It returns the same image back out (image output) so it can sit inline in a graph, plus a second batch_image output that carries the full batch of images it saved.

The reuse path is where it earns its keep. Instead of an image wire, you can give it an asset_ref string (the reference to a previously saved asset) and it loads that saved image back out - no generation, no cost, no upstream re-run. asset_index picks which image from a saved multi-image asset (0 to 999). If both an image and an asset_ref are present, the live image wins.

There's a nice optimization under the hood: when a batch image node ran before this card, the card sniffs the batch's saved originals and copies the actual PNG files (original size, no padding) rather than re-encoding a padded tensor. The pack does this so your saved cards aren't silently losing pixels to tensor padding. The _batch_image_required and _batch_source_node_id inputs are internal flags the frontend sets - leave them alone.

The workflow pattern

Generate → save as card → later reuse. The classic setup: a Comet 图像 node feeds a Comet 图像卡片, and your reference inputs in other workflows use that card's asset_ref - or just drag the saved image back into ComfyUI. For batch work, the card's batch_image output hands the whole batch onward, and the card-to-card reuse means tweaking a downstream node doesn't force you to pay for the generation again.

Install and gotchas

Standard pack install (ComfyUI Manager "ComfyUI-CometAPI", or git clone https://github.com/jieg9341-lab/ComfyUI-CometAPI into custom_nodes, restart). No API key needed for the save/load itself - but the image that flows in was made by a billed call, so reuse is where the savings are.

  • asset_ref is the reuse key. It's a string that names a previously saved asset. If you're not sure what to put there, check the pack's output folder (ComfyUI/output/cometapi_assets) for what was saved.
  • A live image wire overrides asset_ref. If you leave a generation node connected, the card will save that fresh result every run instead of loading the saved one - and that means paying every run.
  • Saved assets live in your output folder, which is local, not in the pack's settings data. Back up your output folder if the saved images matter.
  • The frontend writes the hidden batch flags. Don't hand-edit them; they exist so the card plays nice with batch image nodes in the same graph.
CategoryCOMET

Inputs (6)

NameTypeDefaultDescription
filename_prefixSTRINGCometAPIImageCard
imageoptIMAGE
asset_refoptSTRING
asset_indexoptINT00–999
_batch_image_requiredoptBOOLEANfalse
_batch_source_node_idoptSTRING

Outputs (2)

NameTypeDescription
imageIMAGE
batch_imageIMAGE