Nodes/ComfyUI_EmAySee_CustomNodes/EmAySee Load Image + Name
ComfyUI Node

EmAySee Load Image + Name

Load an image and get its filename out — the dataset workhorse

By EmAySee·Created about a year ago·Updated 4 months ago· 2
EmAySee Load Image + Name
    • image
    • mask
    • filename_stem
    image

    LoadImage, plus the thing you always wanted from it

    Core ComfyUI's LoadImage gives you an image and a mask - that's it. The moment you build anything dataset-shaped, you discover you also need the filename in the graph: to write a matching .txt caption, to log which image failed, to tell an LLM "this file is portrait_0042.png" so its captions stay aligned with your files. EmAySee_LoadImagePlusName is a drop-in clone of the standard loader with one extra output: filename_stem, the file's basename minus extension.

    It's from the EmAySee pack, and for anyone captioning or tagging a folder of images this is the node that makes the loop close: load image → LLM describes it (see EmAySee_LlamaVision) → save the text with the filename from filename_stem → advance. That's a real workflow, not a hypothetical - it's the exact shape of a training-dataset prep pass, which the LoRA-training world lives on.

    How it works

    Same code path as the core loader: it reads the file from ComfyUI's input directory, applies EXIF orientation transpose, converts to RGB, and normalizes to a float tensor. The alpha channel, if present, becomes the mask output (inverted, matching ComfyUI's convention that white = masked region). No alpha? You get a flat 64×64 zero mask as a placeholder. filename_stem is computed with os.path.splitext on the selected file, so cat.pngcat.

    Inputs and outputs

    • image - a dropdown of files in your ComfyUI/input/ folder, with the upload button enabled.

    Outputs:

    • image (IMAGE) - the loaded RGB tensor.
    • mask (MASK) - the alpha channel as a mask, or a 64×64 zero placeholder when there's no transparency.
    • filename_stem (STRING) - the name without extension.

    Install

    From ComfyUI_EmAySee_CustomNodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/EmAySee/ComfyUI_EmAySee_CustomNodes
    # restart ComfyUI
    

    Or via ComfyUI Manager → "ComfyUI_EmAySee_CustomNodes". No extra dependencies or downloads.

    Gotchas

    The mask is the trap. That 64×64 zeros placeholder when the image has no alpha is not a real mask - it's an empty tensor that will silently do nothing (or worse) if you feed it into a mask-gated pipeline expecting coverage. Guard it with the pack's EmAySee_MaskGuard or check your workflow assumptions before relying on it. Also note the dropdown only lists the input folder - same as core LoadImage, so subfolders need path selection. And it's a plain loader: no batching, no automatic next-file advance, so driving a whole folder means looping the workflow, not pointing the node at a directory.

    CategoryEmAySee

    Inputs (1)

    NameTypeDefaultDescription
    imageCOMBO2 options: example.png, matanyone2-demo-input.mp4

    Outputs (3)

    NameTypeDescription
    imageIMAGE
    maskMASK
    filename_stemSTRING