Image PSNR
The dB score everyone quotes, in a single node
- image1
- image2
- mask
- psnr_db
PSNR - peak signal-to-noise ratio - is the number you'll see quoted in every upscaler and restoration paper, and it's a weirdly intuitive one once you get it: it's how strong the "signal" (the original image) is compared to the "noise" (the difference from it), expressed in decibels. Higher is better. 30+ dB looks close to identical; below 20 dB and the two images have clearly drifted apart. The Image PSNR node computes it for you as a single FLOAT from two images.
The nice part of the implementation is that it's just a dressed-up MSE: PSNR is -10 * log10(mse) with the images in [0, 1] range. So the node agrees exactly with the pack's Image MSE node - same number, friendlier unit. Because it's a logarithm, it also compresses the range: a small improvement in MSE shows up as a few dB, and you get a feel for "how much better" at a glance.
The one thing that will confuse you
When the two images are identical, the MSE is zero, the log blows up, and the node correctly returns inf - positive infinity. That's not a bug, but it will break any downstream math that tries to average it or compare it as a number. If your evaluation script can't handle inf, wrap the comparison with a check, or use one of the other metrics for the identical case.
Inputs and outputs
Inputs: image1, image2 (required), mask (optional - restrict the metric to a region, mask=1 included). Output: a single psnr_db FLOAT, also shown on the node in the UI. Both images must have the same spatial dimensions or you get an error; resize first.
Installing it
Part of Duanyll Nodepack. ComfyUI Manager → search "Duanyll Nodepack" → install → restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/Duanyll/duanyll_nodepack
No extra dependencies beyond numpy. Find it under duanyll/metric.
My honest ranking of these metric nodes: for eyeballing, Image DifferenceCmap beats all of them; for a single automated gate, PSNR or the four-in-one Image Diff Metrics (which gives you PSNR plus MSE, MAE, and SSIM consistently masked in one run) are the practical picks. Grab the combo node unless you specifically want just the dB number.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image1 | IMAGE | — | |
| image2 | IMAGE | — | |
| maskopt | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| psnr_db | FLOAT | — |