phpman > man > pnmpsnr(1)

Markdown | JSON | MCP    

TLDR: pnmpsnr (tldr-pages)

Compute the difference between two images.

  • Compute the difference, i.e. the peak signal-to-noise ratio (PSNR) between two images
    pnmpsnr {{path/to/file1.pnm}} {{path/to/file2.pnm}}
  • Compare the color components rather than the luminance and chrominance components of the images
    pnmpsnr {{path/to/file1.pnm}} {{path/to/file2.pnm}} -rgb
  • Run in comparison mode, i.e. only output `nomatch` or `match` depending on whether the computing PSNR exceeds `n` or not
    pnmpsnr {{path/to/file1.pnm}} {{path/to/file2.pnm}} -target {{n}}
  • Run in comparison mode and compare the individual image components, i.e. Y, Cb, and Cr, to the corresponding thresholds
    pnmpsnr {{path/to/file1.pnm}} {{path/to/file2.pnm}} -target1 {{threshold_Y}} -target2 {{threshold_Cb}} -target3 {{threshold_Cr}}
  • Run in comparison mode and compare the individual image components, i.e. red, green, and blue to the corresponding thresholds
    pnmpsnr {{path/to/file1.pnm}} {{path/to/file2.pnm}} -rgb -target1 {{threshold_red}} -target2 {{threshold_green}} -target3 {{threshold_blue}}
  • Produce machine-readable output
    pnmpsnr {{path/to/file1.pnm}} {{path/to/file2.pnm}} -machine
pnmpsnr(1)                           General Commands Manual                           pnmpsnr(1)

NAME
       pnmpsnr - compute the difference between two portable anymaps

SYNOPSIS
       pnmpsnr [pnmfile1] [pnmfile2]

DESCRIPTION
       Reads  two  PBM, PGM, or PPM files, or PAM equivalents, as input.  Prints the peak signal-to-
       noise ratio (PSNR) difference between the two images.  This metric is typically used in image
       compression papers to rate the distortion between original and decoded image.

       If  the  inputs are PBM or PGM, pnmpsnr prints the PSNR of the luminance only.  Otherwise, it
       prints the separate PSNRs of the luminance, and chrominance (Cb and  Cr)  components  of  the
       colors.

       The PSNR of a given component is the ratio of the mean square difference of the component for
       the two images to the maximum mean square difference that can exist betwee  any  two  images.
       It is expressed as a decibel value.

       The mean square difference of a component for two images is the mean square difference of the
       component value, comparing each pixel with the pixel in the same position of the other image.
       For the purposes of this computation, components are normalized to the scale [0..1].

       The maximum mean square difference is identically 1.

       So  the  higher  the  PSNR, the closer the images are.  A luminance PSNR of 20 means the mean
       square difference of the luminances of the pixels is 100 times less than the maximum possible
       difference, i.e. 0.01.

SEE ALSO
       pnm(5)

                                          04 March 2001                                pnmpsnr(1)

Generated by phpman v4.0 Author: Che Dong Under GNU General Public License
2026-06-16 00:53 @216.73.217.83
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 TransitionalValid CSS!