ComfyUI Node

LoadImageAdvanced

A Load Image That Also Plans Your Resolution (And Works When Turned Off)

By Fictiverse·Created 3 years ago·Updated 29 days ago· 27
LoadImageAdvanced
    • _
    image_file
    enabletrue
    scale_imagefalse
    megapixel1.0
    ratio1:1
    orientationfalse

    Core ComfyUI's Load Image hands you whatever pixels the file happens to have. That's fine until you're feeding a batch of images that all arrive at different sizes, and the workflow needs them at one consistent resolution - same megapixels, same aspect ratio, so the latent always lines up with the image. Normally you'd chain a resize node after the loader and read the dimensions manually. LoadImageAdvanced does load, resize, and resolution reporting in one node. And it keeps working even when you switch it off, which is the clever bit.

    How it works

    It reads from ComfyUI's input folder like any loader, converts to RGB, and then does one of two things based on scale_image. With scaling on, it resizes the image to your target megapixel with Lanczos - the same pick most upscaling advice settles on for "resize without inventing detail". With scaling off, it just nudges the dimensions up to a multiple of 32, because diffusion latents are picky about dimensions. Either way, your image comes out in a shape the model can actually chew on.

    The part that's genuinely unusual: when enable is off, it doesn't fail or drop out. It computes the correct dimensions from your ratio, orientation, and megapixel settings and emits a plain black image at that size. The rest of your graph keeps running with a valid tensor; you've just told it "skip the real image but keep the geometry." Handy when you want to toggle an image branch without rewiring half the workflow.

    The inputs that matter

    • image_file - the dropdown of images in your input folder.
    • enable - master switch. Off means "blank image, but keep the planned dimensions."
    • scale_image - on = resize to the megapixel target; off = only snap to a multiple of 32.
    • megapixel - target size (0.1 to 16). This is total pixels, not a side length.
    • ratio - the aspect presets (1:1, 4:3, 16:9, 21:9, 32:9, …).
    • orientation - portrait vs landscape; swaps width and height.

    Output: one _ socket of type IMAGE_PARAMS - a packed wire carrying the image plus its width, height, megapixel, and enabled flag.

    The trap to know about

    The output is not an IMAGE. It's a custom IMAGE_PARAMS wire, so you can't hook it straight into a VAE Encode or a KSampler. It has to go through the pack's UnpackImageParams first, which splits it back into the image tensor, width, height, megapixel, and enabled. That's the classic beginner stumble with this node: Load → Unpack → everything else. Once you see it as a two-node pair, the design clicks.

    A couple of smaller notes. A "1 megapixel" target won't land exactly on 1,000,000 pixels because it rounds to a multiple of 32 - expect something like 992×1024. And if you disable it, you get a black placeholder, not your image, so keep enabled on unless you actually want the blank.

    Installing it

    It ships in ComfyUI Fictiverse Nodes. ComfyUI Manager: search for ComfyUI Fictiverse Nodes, install, restart. Or by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Fictiverse/ComfyUI_Fictiverse
    

    Then restart. No dependencies, no model downloads - the pack's requirements.txt is empty and it only uses things ComfyUI already ships (PIL, numpy, torch).

    CategoryFictiverse/Image

    Inputs (6)

    NameTypeDefaultDescription
    image_fileCOMBO1 options: example.png
    enableBOOLEANtrue
    scale_imageBOOLEANfalse
    megapixelFLOAT1.00.1–16
    ratioCOMBO1:18 options: 1:1, 5:4, 4:3, 3:2, 16:9, 2:1, +2
    orientationBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    _IMAGE_PARAMS