Nodes/ComfyUI_FunCode/Load Image FunCode
ComfyUI Node

Load Image FunCode

A Load Image with a gallery and a refresh habit

By kaiery·Created 8 months ago·Updated about a month ago· 0
Load Image FunCode
    • image
    • mask
    image

    Let's be direct: Load Image FunCode is a near-clone of core ComfyUI's Load Image, dressed up with a nicer front end. It pulls a file from your input directory, hands you an image and a mask, and does the standard PIL dance - EXIF rotation corrected, converted to RGB, normalized to 0–1. If that's all you need, the core node already does it and you can stop reading.

    What FunCode adds is worth one honest paragraph. First, a file-mtime IS_CHANGED, so the node re-runs whenever the file on disk actually changes - useful if another tool is dropping new images into input/ and you want ComfyUI to notice without you poking it. Second, a bundled front end: the node gets an "Open Gallery" button that pops a preview overlay so you can eyeball the current input/ contents before picking, instead of squinting at a dropdown of filenames. And its image input is marked image_upload, so you can still click to upload a fresh file the usual ComfyUI way.

    How it works

    Under the hood it's the same pipeline as core: Image.open, exif_transpose (so phone photos with rotation tags come in right-side-up), convert("RGB"), then a numpy array scaled to 0–1 with a batch dimension added. The mask is where a beginner can get tripped up: if the image has an alpha channel, the mask is inverted alpha - 1 − alpha, matching ComfyUI's mask convention where "1" means masked/hidden. Transparent areas come out as 1; no alpha channel means a zero mask. Wire the mask into an inpaint workflow and transparent regions get filled; wire it nowhere and nothing changes.

    Inputs and output

    • image - a dropdown of the image files in ComfyUI/input/ (PNG, JPG, JPEG, BMP, WebP, TIFF, GIF), with an upload option. That's the one input.
    • Outputs: image (the IMAGE tensor) and mask (the MASK tensor). Same shapes as core Load Image, so any downstream node that accepts a core Load Image output accepts these.

    Installing

    cd ComfyUI/custom_nodes
    git clone https://github.com/kaiery/ComfyUI_FunCode
    

    Restart ComfyUI, find it under FunCode/Image. No model downloads, no pip dependencies. Note the gallery button only appears once the browser tab has reloaded - restart the backend and refresh the page, or the JS that adds it won't be loaded.

    Gotchas

    • Mask direction - remember it's inverted alpha. If your inpaint is filling the wrong thing, you're likely treating mask=1 as "keep" when this node means "hide."
    • The dropdown is a snapshot - file lists build at node-creation time. If you drop a new file into input/ and it doesn't show, recreate the node (or toggle it) to rescan.
    • Thin wrapper, thin expectations - this is a convenience clone, not a feature mountain. If the gallery isn't worth an extra pack in your install, core Load Image is fine and this article was a free read.

    It's the honest kind of node: does one thing, does it like core does, adds a small nicety, and stays out of your way. For the workflow that's exactly what you want.

    CategoryFunCode/Image

    Inputs (1)

    NameTypeDefaultDescription
    imageCOMBO1 options: example.png

    Outputs (2)

    NameTypeDescription
    imageIMAGE
    maskMASK