Nodes/ComfyUI-Image-Filters/Batch Average Image
ComfyUI Node

Batch Average Image

Turn a stack of frames into one clean average

By spacepxl·Created 3 years ago·Updated 8 months ago· 293
Batch Average Image
  • images
  • IMAGE
operation

Sometimes you don't want every frame in a batch - you want the one image that represents all of them. Batch Average Image collapses an entire image batch down to a single output by averaging across it, which is a genuinely useful move in a few specific situations: canceling out per-frame noise, checking what a "typical" frame in a generated sequence looks like, or building a clean base plate from multiple near-identical shots.

How it works

Nothing fancy under the hood - it's exactly what the name says. Stack up your batch and take either the mean or the median across all frames at each pixel. Mean is the standard averaging you'd expect: fast, smooth, and it'll blur out any motion or difference between frames (which is either the point or the problem, depending on what you're doing). Median is the one to reach for when a handful of frames in your batch are outliers - a glitch frame, one with an artifact, one that just came out wrong - since the median naturally ignores anything that isn't the majority value at each pixel, where a mean would drag the whole average toward the bad frame.

Inputs and outputs that matter

Just two fields:

  • images - your batch. Any batch size works; this is a batch-dimension reduction.
  • operation - mean or median. Mean if your batch is genuinely similar frames and you want a smooth blend (denoising by averaging is a classic trick). Median if you expect a few frames to be bad and don't want them dragging the result.

Output is a single IMAGE - the batch dimension collapses to 1.

Installing it

Through ComfyUI Manager: search ComfyUI Image Filters. By hand:

cd ComfyUI/custom_nodes
git clone https://github.com/spacepxl/ComfyUI-Image-Filters

Restart afterward. It's a pure filter node - no models to download - but the pack does depend on opencv, and if you've got another node pack that installed a conflicting opencv build, you'll hit import errors on startup. The maintainer's import_error_install.bat reinstalls all four opencv variants in matching versions to fix that; the manual version of the same fix is uninstalling every opencv-* package and installing only opencv-contrib-python.

Where people get burned

The biggest gotcha isn't the node itself, it's forgetting the source of your batch matters. If the frames in your batch aren't actually aligned - different subjects, different compositions, or a video batch with real motion in it - averaging them just produces a ghosted mush, not a clean image. This node has no alignment step; if you need frames aligned first, look at Batch Align (RAFT) from the same pack before averaging.

Also worth knowing: if you're averaging to reduce per-pixel noise or grain across near-identical renders, mean genuinely helps because random noise cancels out over enough samples - but if the "noise" you're seeing is actually structural (a flickering detail that's consistently different, not random), averaging won't fix it and might just blur it into a smear. That's a symptom to fix upstream, not by averaging harder.

CategoryImage-Filters/image

Inputs (2)

NameTypeDefaultDescription
imagesIMAGE
operationCOMBO2 options: mean, median

Outputs (1)

NameTypeDescription
IMAGEIMAGE