Nodes/ImagePromptBatch/Load Image and Prompt
ComfyUI Node

Load Image and Prompt

It Says 'Load Image and Prompt' — It Actually Just Picks From a CSV

By pacchikAI·Created about a year ago·Updated 10 months ago· 1
Load Image and Prompt
    • Image Name
    • Prompt
    FolderLocation
    PromptFileName
    index

    LoadImageandPrompt is a tiny CSV lookup dressed up as a node, and it exists because batch img2img/img2vid is a pain. You have a hundred images, each with its own prompt, and you want to run them through WAN2.1 (or any img2img pipeline) one at a time without hand-editing a prompt widget between every run. This node hands you the right filename and the right prompt for each step of the batch. It was literally built to answer a r/comfyui question about batch-loading images and prompts for WAN2.1 - the author, "pacchithewizard," got called a rare addition to the community for it. Modest legend energy for a ~30-line utility.

    Here's the first thing to unlearn: the name is a lie. The node does not load an image. It reads a row from a CSV and returns two strings - the image's filename and the prompt text. The actual image loading is left to whatever you wire the filename into (the bundled example uses Video Helper Suite's VHS_LoadImagePath). Expect that, and the node makes total sense; expect an image tensor out of it, and you'll be confused for an afternoon.

    How it works

    Under the hood it's dead simple: it opens FolderLocation + PromptFileName as a CSV, skips the header row, and scans for a row whose first column matches your index. When it finds one it returns the second column (the filename) and third column (the prompt). No database, no state, no fancy caching - just a straight line from index to a CSV row. The whole pack is one file, no requirements.txt, no model downloads, pure Python standard library.

    The trick that makes it a "batch" node is how you drive index. ComfyUI's Seed node increments by default each time you queue. Wire that seed into index, set it to 0, and queue as many runs as you have rows in the CSV - run 0 reads row 0, run 1 reads row 1, and so on. That's the entire loop, and it's the same pattern the community lands on whenever this question comes up: queue N generations and let a counter step.

    The inputs that matter

    Three required inputs, and you'll set all of them:

    • FolderLocation - the folder holding your images and the CSV. String. This one bites people: the code concatenates FolderLocation + PromptFileName and FolderLocation + filename with no separator, so it must end with a /. The author's own example workflow has a note saying exactly that: "don't forget to add the '/' in the end."
    • PromptFileName - just the CSV's name, like prompt.csv. The folder part comes from the input above.
    • index - the INT row selector. Start at 0, or let a seed/counter feed it.

    The outputs are the two strings: Image Name (a full path like /home/user/test/test1.png, ready to feed a path-based image loader) and Prompt (wire it into your positive CLIP text encode).

    Installing it

    ComfyUI Manager: search for "ImagePromptBatch" and hit install. Or the manual route:

    cd ComfyUI/custom_nodes
    git clone https://github.com/pacchikAI/comfyui_pacchik_ImagePromptBatch
    

    Then restart ComfyUI. That's it - no dependencies beyond what's already in your Python environment, which is the nicest thing about this pack.

    The CSV and the gotchas

    The CSV needs exactly three columns - index, filename, prompt - with a header row that gets skipped. The repo ships a sample_prompt.csv showing the format:

    Index, Filename, Prompt
    0,test1.png, "This is for test1"
    1,test2.png, "for test2.png"
    

    Where people get burned:

    • Queueing past the end of the CSV. If index has no matching row, the node prints No entry found with index N and returns None, None - which then breaks whatever is downstream. Count your rows before queueing.
    • Forgetting the trailing slash on FolderLocation, producing paths like testtest1.png.
    • Expecting an image out of it. It's a string source, not a loader. Pair it with VHS_LoadImagePath or any node that turns a path into an image, and keep the filenames in the CSV identical to the files in the folder.

    It's a one-job tool with a slightly misleading name, but for "run 100 images, each with its own prompt, through an img2img pipeline" it's the simplest thing that works.

    CategoryPacchiK Nodes

    Inputs (3)

    NameTypeDefaultDescription
    FolderLocationSTRING
    PromptFileNameSTRING
    indexINT

    Outputs (2)

    NameTypeDescription
    Image NameSTRING
    PromptSTRING