Nodes/ComfyUI-JDCN/JDCN_LoadImage
ComfyUI Node

JDCN_LoadImage

A LoadImage that hands you the alpha as a mask (and loads GIFs as batches)

By daxcayΒ·Created 2 years agoΒ·Updated about a year agoΒ· 159
JDCN_LoadImage
    • image
    • image_mask
    β—„imageβ–Ύβ–Ί
    β—„save_in_exportfalseβ–Ί

    Let's be honest up front: ComfyUI already has a perfectly good LoadImage. JDCN_LoadImage is that node re-skinned with a couple of extras that matter if you work with transparency or animated images. If you just need to load a flat JPG into a workflow, use the built-in one and save yourself a dependency. If you need the alpha channel as a mask, or you keep loading GIFs and MPOs, this one does something the stock node makes you rig up yourself.

    What it does

    It reads from the same place as core LoadImage - the ComfyUI/input folder - and gives you the same two outputs:

    • image (IMAGE) - the pixels as a float tensor, normalized to 0–1, exactly like the core node.
    • image_mask (MASK) - the alpha channel turned into a mask. White = opaque, black = transparent (it's 1 - alpha, the ComfyUI convention). For images with no alpha it returns a blank mask, so the output type never changes and downstream nodes don't complain.

    Two behaviors are actually worth the install. First, it honors EXIF orientation - phone photos won't come in sideways. Second, it runs through every frame of animated formats: a GIF or an MPO comes out as a batch of images instead of just the first frame. Each frame has to match the first one's size, which is the sensible thing, and multi-frame inputs get concatenated into a single IMAGE batch you can feed straight to a sampler or video node.

    The inputs

    • image - a dropdown of files in your input directory, with the usual upload button. Only files at the top level of input show up, no subfolders.
    • save_in_export - a boolean that looks like it controls whether the loaded file gets copied into ComfyUI's export area. It's declared in the interface but in the shipped code it doesn't change anything yet. Set it and forget it; don't build a workflow around it.

    There's also a genuinely nice detail in how it detects changes: IS_CHANGED hashes the file's contents, so if you overwrite beach.jpg on disk and re-run, the node actually reloads it instead of serving the cached version.

    Install

    Part of the ComfyUI-JDCN pack. Quickest route is ComfyUI Manager β†’ Install Custom Nodes β†’ search "JDCN", or:

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

    The pack's only real dependency is piexif (and psutil, already present in ComfyUI). No models, no downloads.

    Gotchas

    • Only the top level of input is scanned - put your file in a subfolder and it won't appear in the dropdown.
    • Frames that don't match the first frame's dimensions are silently skipped, not resized. If a GIF comes back with fewer frames than expected, that's why.
    • It's a reader, not a cache: every run re-reads and re-hashes the file. Fine for stills; just know the console chatter on big batches is normal.

    If you're not doing alpha masks or animated files, the stock node does the job. If you are, this saves you a MaskFromAlpha rig and an ImageSequence hack every time.

    CategoryπŸ”΅ JDCN πŸ”΅

    Inputs (2)

    NameTypeDefaultDescription
    imageCOMBO4 options: beach.jpg, eth3d.png, example.png, middlebury.jpg
    save_in_exportBOOLEANfalseβ€”

    Outputs (2)

    NameTypeDescription
    imageIMAGEβ€”
    image_maskMASKβ€”