Nodes/ComfyUI Image & Prompt Loader/Image & Prompt Loader
ComfyUI Node

Image & Prompt Loader

Grab a Civitai image and its exact prompt, seed, and CFG — without the copy-paste ritual

By hassan-sd·Created about a year ago·Updated about a year ago· 3
Image & Prompt Loader
    • image
    • prompt
    • negative_prompt
    • seed
    • steps
    • cfg_scale
    • ui_info
    input_modelocal_upload
    image
    custom_image_path
    civitai_url
    civitai_api_token

    You see an image on Civitai you want to riff on. You copy the prompt, the negative, the seed, the CFG, the step count - five separate copy-pastes into text boxes, and odds are you mangle at least one of them. The Image & Prompt Loader exists to kill that whole ritual. Feed it a Civitai URL (or a local image) and it hands back the image and the exact generation metadata that produced it, as outputs you can wire straight into a sampler.

    That's the point, and it's a real one. Civitai images carry their generation parameters in metadata - the "workflow included" norm this ecosystem runs on. The data is already there; it's just stuck on the website. This node is the bridge. In the wider graph it slots in exactly where a normal LoadImage does: image → VAE Encode for an img2img remix, prompt → CLIP Text Encode, seed and CFG → KSampler. It's equally handy for dataset work - point it at a folder of images with caption .txt files and it'll pull the prompt for you while you audit the batch.

    How it works

    Three input modes, set with one dropdown:

    • local_upload - the standard ComfyUI upload widget; behaves like a plain LoadImage.
    • local_path - a full filesystem path to any image.
    • civitai_url - the interesting one. The node calls Civitai's public API (api/v1/images?imageId=<id>), not the web page, and needs no API key for public images. It reads prompt, negativePrompt, seed, steps, and cfgScale out of the returned JSON, then downloads the image into ComfyUI's input folder so the preview updates automatically.

    For local images it looks for a caption file first - image.txt or image.jpg.txt, in plain text (with a Negative: marker) or JSON - then falls back to the EXIF UserComment field. Priority is fixed: Civitai metadata, then caption file, then EXIF.

    The inputs that actually matter

    • input_mode - the only thing you'll switch most days.
    • civitai_url / civitai_api_token - the token is optional and only needed for private images (get one at your Civitai account settings).
    • custom_image_path - required for local_path mode.
    • image - the upload widget; only used in local_upload mode, harmless to ignore otherwise.

    Outputs

    Seven of them: image (IMAGE), prompt and negative_prompt (STRING), seed (INT), steps (INT), cfg_scale (FLOAT), and ui_info (STRING). Wire prompt → positive CLIP Text Encode, negative_prompt → negative, seed → KSampler, image → VAE Encode for img2img. ui_info is the debugging output - if seed reads 0 when you expected a real one, check it.

    Installing

    ComfyUI Manager → search "Image & Prompt Loader" → Install, or the manual route:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/hassan-sd/comfyui-image-prompt-loader.git
    cd comfyui-image-prompt-loader
    pip install -r requirements.txt
    

    Then restart ComfyUI. This one's refreshingly light: the only dependency beyond ComfyUI's bundled stack is requests. No model downloads, no CUDA surprises.

    Where people get burned

    • The "smart dataset detection" that hunts for matching folders searches hardcoded Windows paths (D:\datasets\gallery-dl\...). On Linux or macOS that fallback quietly does nothing - but the primary same-directory caption search works everywhere, so you'll usually be fine.
    • Remember the priority order: a stray caption file will silently override EXIF, and the EXIF path only reads the UserComment field as JSON. Old A1111-style PNGs stash params in tEXt chunks, not EXIF, so that route can come up empty - which is exactly why the Civitai API is the primary source for Civitai images.
    • Every Civitai download lands in ComfyUI/input/ as civitai_node_*.png. They accumulate. That's expected, not a bug.
    • Missing metadata doesn't error out - you just get zeros and empty strings. Useful, but easy to mistake for broken wiring.

    The honest take

    This is a young, single-author utility - a handful of registry impressions and no community chatter to speak of, so don't expect a support forum. But it's one Python file with one dependency, and the core trick, reading Civitai's public metadata API, is solid. If you remix Civitai images regularly, it quietly deletes the most boring part of the job.

    Categoryimage

    Inputs (5)

    NameTypeDefaultDescription
    input_modeCOMBOlocal_upload3 options: local_upload, local_path, civitai_url
    imageCOMBO1 options: example.png
    custom_image_pathoptSTRING
    civitai_urloptSTRING
    civitai_api_tokenoptSTRING

    Outputs (7)

    NameTypeDescription
    imageIMAGE
    promptSTRING
    negative_promptSTRING
    seedINT
    stepsINT
    cfg_scaleFLOAT
    ui_infoSTRING