Nodes/RisuTools/Load Image From Text
ComfyUI Node

Load Image From Text

LoadImage, but the filename is a string you can wire

By tiamatiramisu·Created about a year ago·Updated about a year ago· 5
Load Image From Text
    • IMAGE
    • MASK
    nameimage_name
    directoryabsouute-path
    prefix

    Load Image From Text is ComfyUI's built-in LoadImage wearing a different outfit. Same inputs-outputs shape, same internals - the author says so in a source comment - except instead of picking a file from a dropdown, you hand it a directory, a filename, and an optional prefix as plain text. That one change makes it dramatically more useful in automation.

    Here's the problem it solves. Core LoadImage only shows you files from ComfyUI's input/ folder (or whatever you uploaded), chosen by hand. That's fine for a one-off. It's useless when the filename is decided by something else at runtime - a script that just dropped a new image, another node that computed a name, a workflow that reads from an arbitrary folder on disk. When the file's identity is data flowing through your graph instead of a static choice, you need a loader that accepts a string. This is that node.

    How it works

    The mechanism is, again, basically core LoadImage. It joins directory + prefix + name into a path, opens it with PIL, and converts it into the two tensors ComfyUI works with: an IMAGE (RGB, float, 0–1, batched) and a MASK (1.0 where transparent). Alpha channels and PNG transparency become masks; an opaque image gets a blank 64×64 mask of zeros, same as core. EXIF rotation is applied, and animated formats load as multiple frames. It even inherits core's tolerance for truncated image files.

    Two things it does better than typing a path into a text node by hand:

    • Its IS_CHANGED hashes the file's bytes, so the node re-runs whenever the file on disk changes - and skips when it hasn't. Good for watching a folder.
    • If the directory path is wrong or the file is missing, you get a clean error at execution.

    The inputs that matter

    Three inputs, only two you'll usually touch:

    • name (required) - the filename, extension included. Default "image_name" is a placeholder; this is where Load Last File Name Prefix's output plugs in.
    • directory (required) - absolute path to the folder. The shipped default is the literal typo "absouute-path" - the author's own placeholder, so don't worry, it's not you.
    • prefix (optional, defaults to "") - prepended to the name. Handy if you build the name without the prefix, or want to namespace files.

    Outputs are IMAGE and MASK, the standard pair - IMAGE into anything that consumes images (VAE encode, image-to-image, save nodes), MASK into anything that consumes masks.

    Where people get burned

    The filename must include its extension - photo.png, not photo. The path is absolute and only absolute; no shortcuts into ComfyUI's input folder. And there's no validation box before you run: the source's VALIDATE_INPUTS is commented out, so a wrong path won't turn red on the canvas - you find out when the workflow executes and errors. That's worth knowing if you're debugging at 1am. On the bright side, the resulting image loads into standard ComfyUI format, so anything downstream behaves exactly as it would with core LoadImage.

    Installing it

    One of four nodes in RisuTools. ComfyUI Manager → search RisuTools → Install → restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/TiamaTiramisu/risutools
    

    Restart ComfyUI. No models, no extra dependencies beyond pillow and numpy (already present in any ComfyUI install). The pack is young - version 0.0.1 - but this node is a faithful, readable reimplementation of a node you already trust, which is honestly the best thing you can say about a custom loader.

    CategoryRisuTools/image

    Inputs (3)

    NameTypeDefaultDescription
    nameSTRINGimage_name
    directorySTRINGabsouute-path
    prefixoptSTRING

    Outputs (2)

    NameTypeDescription
    IMAGEIMAGE
    MASKMASK