Nodes/comfyui-prompt-sequence/Prompt Image Mask Sequence
ComfyUI Node

Prompt Image Mask Sequence

A prompt card library that hands back pictures and masks

By Localsmile·Created 3 months ago·Updated 3 months ago· 0
Prompt Image Mask Sequence
    • prompt
    • image
    • mask
    selection_json{}
    modesequential
    seed-1
    max_items0

    This is the outlier in the prompt-sequence pack. The other five nodes deal in text lists; this one runs a full card library that outputs three aligned lists at once - prompt, image, and mask. You browse a thumbnail grid of saved prompt cards, tick the ones you want, and it hands each checked card's text, its reference image, and its optional mask to whatever you plug downstream. Same batch idea as the rest of the pack, just with the visuals attached.

    Where that actually earns its keep: character consistency work. If you're feeding an IPAdapter-style reference image per prompt - same character, different scenes, shot after shot - this node is the one that keeps the prompt and its reference image in lockstep so index 3 of the text list always matches index 3 of the image list. The same pairing makes it handy for batch inpainting: prompt + source frame + its mask, fed into a VAE Encode + KSampler loop that regenerates one region across a whole sequence.

    How it works

    Every card you save becomes a small folder inside the pack's own directory - projects/<project>/<topic>/<prompt-id>/ holding a prompt.json plus image.png and, if you upload one, mask.png. Unlike its text-only sibling, this node stores the full-resolution image untouched, and the mask is optional. The thumbnail grid you see in the node isn't a ComfyUI core widget - it's a custom frontend in web/prompt_sequence.js talking to the pack's own HTTP routes (/prompt_sequence/assets*) registered when the pack loads. That's also why the selection_json input exists: it's the hidden serialized state of which cards are checked, and the tooltip's advice is the whole truth - "use the thumbnail grid instead of editing this manually." Leave it alone.

    What you actually set is three things: mode (sequential or random), seed, and max_items. Sequential runs your checked cards top to bottom; random shuffles first, and seed = -1 (the default) rolls a new order every queue, while a fixed seed repeats the same order - which is the deterministic-variation trick every node in this pack shares. max_items = 0 means "everything checked," anything above that trims the list. Internally, random-plus-seed--1 makes the node report itself as always-changed (the float("NaN") IS_CHANGED trick), so it genuinely re-runs and reshuffles each time instead of being cache-poisoned into a repeat.

    Outputs

    • prompt - a STRING list, wired into CLIP Text Encode.
    • image - an IMAGE list, for IPAdapter/ControlNet-style reference inputs.
    • mask - a MASK list, for the mask socket on KSampler or VAE Encode.

    All three are index-aligned, so card #3's prompt, image, and mask travel together. An empty library or a blank prompt still returns something - a blank 1×1 image and mask with an empty string - so downstream nodes don't crash.

    Install

    Same as the rest of the pack: ComfyUI Manager, search comfyui-prompt-sequence, install, restart. Or by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Localsmile/comfyui-prompt-sequence
    

    No extra pip dependencies and no model files - it only uses Pillow, numpy, and torch, all of which ComfyUI already ships.

    Where people get burned

    The library lives inside the pack folder. If you delete the pack or uninstall it via Manager, your cards die with it. The README's own escape hatch is to copy the whole custom node folder - that carries the library along and lets you share it with a workflow. It's also worth knowing this is a small, early pack (single commit, zero community footprint), so test it on cards you don't care about before you trust it with a real project.

    Categoryprompt sequence

    Inputs (4)

    NameTypeDefaultDescription
    selection_jsonSTRING{}Hidden picker state. Use the thumbnail grid instead of editing this manually.
    modeCOMBOsequentialsequential: use checked cards in order. random: shuffle checked cards before output.
    seedINT-1-1–9223372036854776000For random mode: -1 makes a new order each queue; a fixed value repeats the same order.
    max_itemsINT00–100000 outputs all checked records. A positive value outputs up to that many records.

    Outputs (3)

    NameTypeDescription
    promptSTRING
    imageIMAGE
    maskMASK