Nodes/ComfyUI-Light-Tool/Light-Tool: Load Image
ComfyUI Node

Light-Tool: Load Image

A Load Image that can actually keep your transparency

By ihmily·Created 2 years ago·Updated 4 months ago· 20
Light-Tool: Load Image
    • image
    • mask
    image
    keep_alpha_channelfalse

    Core ComfyUI's Load Image drops your alpha channel on the floor and it's a known sore spot for anyone compositing cutouts. Light-Tool: LoadImage is the pack's version of the same node, with one extra checkbox that fixes the recurring complaint: keep_alpha_channel. Tick it and your RGBA PNG arrives as a real RGBA tensor instead of being flattened to RGB.

    Inputs: image - a file picker over your ComfyUI input folder (drag-drop upload works), plus keep_alpha_channel, default off. Outputs: image and mask.

    How it works. It's a faithful reimplementation of the stock loader: EXIF orientation is applied, I-mode images are rescaled, and multi-frame files are stacked. The difference is the alpha handling. With keep_alpha_channel on, RGBA stays RGBA. Off - the default - the image is converted to RGB, same as core. Either way, the mask output is derived from the original alpha channel as 1 - alpha, which is the ComfyUI convention: the mask is white where the image is transparent, and a 64×64 black mask is returned when there's no alpha at all.

    Why you'd flip the checkbox. If the rest of your graph needs the alpha as data - feeding ImageToMask with the alpha channel, compositing with ImageOverlay, or running a branch with IsTransparent - the alpha has to survive the load. This node is the pack's own front door for that, and the mask output on the side gives you the inverted-alpha mask for inpainting without a separate node.

    The honest comparison. If you never touch alpha, this node is functionally identical to the stock Load Image and you gain nothing. It earns its place in two scenarios: you're already using this pack elsewhere and want the loader's behavior to match, or you specifically need keep_alpha_channel to stop transparency from being destroyed at the door. Note the checkbox only affects the image conversion - the mask is always computed from the source alpha, so inpainting-style workflows get the mask they need regardless.

    Installing. Every node in this pack installs together:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ihmily/ComfyUI-Light-Tool.git
    pip install -r requirements.txt
    # restart ComfyUI
    

    Or ComfyUI Manager → search ComfyUI-Light-Tool → Install. No model downloads - this is a pure utility pack, and the loader leans on Pillow, which every ComfyUI already ships.

    Gotchas. The file list is read from the standard input directory, so the picker dropdown behaves like core. File caching is content-addressed (hash-based), so changing a file in place triggers a reload, which is the behavior you want. One small thing to know: keep_alpha_channel is off by default, and the moment you forget to tick it, your "transparent" image silently becomes RGB - which then makes every alpha-dependent node in the graph misbehave. If you're wondering why the alpha is missing, check this box first.

    CategoryComfyUI-Light-Tool/image/LoadImage

    Inputs (2)

    NameTypeDefaultDescription
    imageCOMBO1 options: example.png
    keep_alpha_channelBOOLEANfalse

    Outputs (2)

    NameTypeDescription
    imageIMAGE
    maskMASK