LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

pnmpsnr

Calculate peak signal-to-noise ratio between images

TLDR

Compare two PNM images and display PSNR
$ pnmpsnr [original.pnm] [compressed.pnm]
copy
Compare a JPEG conversion against the original (using Netpbm conversion)
$ pnmpsnr [original.ppm] [converted.ppm]
copy
Compare images from a pipeline (second image from stdin)
$ pnmpsnr [reference.pnm] < [comparison.pnm]
copy

SYNOPSIS

pnmpsnr [file1] [file2]

DESCRIPTION

pnmpsnr calculates the Peak Signal-to-Noise Ratio (PSNR) between two PNM images. PSNR is a standard metric for measuring image quality, commonly used to evaluate the fidelity of compressed or processed images against the original.Higher PSNR values (measured in decibels) indicate greater similarity between the images. Typical values range from 30-50 dB for acceptable quality, while identical images produce an infinite PSNR. For color images, the tool reports PSNR for each channel (red, green, blue) as well as an overall luminance value.Both images must have the same dimensions and depth. Part of the Netpbm toolkit.

PARAMETERS

file1

First input image (reference/original).
file2
Second input image (comparison/distorted). Reads from standard input if omitted.

CAVEATS

Images must have the same dimensions. Only supports PNM/PAM formats; convert other formats first using Netpbm tools. PSNR is not always a reliable indicator of perceptual quality.

SEE ALSO

pnmarith(1), pamarith(1), pamfile(1), pnmcat(1)

Copied to clipboard
Kai