Nodes/Image History/Image History
ComfyUI Node

Image History

Your last render, without the drag-and-drop dance

By Jasshl·Created 24 days ago·Updated 22 days ago· 1
Image History
    • image
    • info
    go_back0
    subfolder
    keep_current_imagetrue
    follow_latest_at_zerotrue

    You just ran a generation you like, and now you want to do something to it - img2img it, upscale it, ControlNet it, run a WD14 tagger over it and regenerate the prompt. The boring way is to drag the output PNG back onto the canvas. The trap is that drag re-embeds the entire workflow inside the file, so your clean "take the latest image, do a second pass" graph suddenly depends on whatever produced it. Image History is the no-drama alternative: it reads straight from ComfyUI's output folder and hands you the newest image as a normal IMAGE tensor, no file hunting, no embedded workflow baggage.

    It's a plumbing node in the best sense. The pattern people actually use it for is iteration chaining - "load last image from output folder → tagger → sampler → save," where each run's output becomes the next run's input without you touching anything. Set it up once and it just follows along.

    How it works

    Under the hood it scans your output directory (optionally one subfolder), keeps PNG/JPG/JPEG/WebP files, and sorts them by modification time. go_back = 0 grabs the newest file, go_back = 1 the previous one, and so on - an index from the end of the list, not a filename. The image loads through PIL, converts to RGB, normalizes to a float tensor, and comes out as a standard IMAGE ready for any sampler, upscaler, or ControlNet input.

    The clever bit is invisible. The node's IS_CHANGED method returns NaN, the classic always-rerun trick: ComfyUI compares NaN != NaN as always-true, so this node fires on every execution and re-checks the folder. That's what lets go_back = 0 keep following new outputs. The same trick is why the node can't be cached away - worth knowing if a workflow with it feels "stuck on," because it re-runs every time by design.

    The inputs that matter

    • go_back (INT, default 0): how far back in history to reach. 0 = newest, 1 = previous, up to 9999. The one you'll touch constantly.
    • subfolder (STRING, default ""): empty means the whole output dir. If you're running several workflows into the same output folder, this keeps "newest" from meaning "newest from some other workflow." Set it to your workflow's output subfolder and thank me later.
    • keep_current_image (BOOLEAN, default true): the one that bites. With it on, when the workflow re-runs it re-pins the exact file you had selected, adjusting go_back behind the scenes so a fresh output doesn't steal your selection. For genuine chaining where you want to roll forward to the newest output each run, flip this off.
    • follow_latest_at_zero (BOOLEAN, default true): lets go_back = 0 keep tracking new outputs; disable to freeze the file currently at index 0.

    Outputs: image (IMAGE) is the tensor you wire downstream. info (STRING) is a short label like LATEST | 00001-1234567890.png or 3 back | foo.png - handy for a text display node, or just so you can see in the node preview exactly which file you grabbed. The node also shows an image preview right on the canvas, so "did it pick the right file?" is always one glance away.

    Installing it

    ComfyUI Manager: search Image History, install, restart. Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Jasshl/ComfyUI-Image-History.git
    

    Then restart ComfyUI. It shows up under history tools. No model downloads, no Python dependencies beyond what ComfyUI already ships - the package declares none at all. This is a one-file node; install takes seconds.

    Where people get burned

    • Empty folder or wrong subfolder → you get a 512×512 black image and info saying "no images found". It doesn't error, it silently gives you black. If your second pass is outputting pure darkness, check the subfolder spelling.
    • go_back past the end of history → clamped to the oldest file rather than erroring. Set 9999 and you'll get whatever's oldest in that folder.
    • Keep-current is on by default. If you set this up expecting "newest image every run" and it keeps reusing the same file, this is why. For feedback-loop workflows, turn it off.
    • Only PNG, JPG, JPEG, WebP count. Your stray BMP or TIFF in the output folder is invisible to it.

    It won't change your life on a one-off workflow. But for anything that loops output back into input - style-iteration chains, taggers, second-pass upscaling - it kills the most annoying manual step in the whole loop.

    Categoryhistory tools

    Inputs (4)

    NameTypeDefaultDescription
    go_backINT00–9999
    subfolderSTRING
    keep_current_imageBOOLEANtrue
    follow_latest_at_zeroBOOLEANtrue

    Outputs (2)

    NameTypeDescription
    imageIMAGE
    infoSTRING