Linux Commands Examples

A great documentation place for Linux commands


compute the difference between two portable anymaps


pnmpsnr [pnmfile1] [pnmfile2]

add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!


no example yet ...

... Feel free to add your own example above to help other Linux-lovers !


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


How can this site be more helpful to YOU ?

give  feedback