I can get PPI for a JPEG image using the following command:
$ identify -format \"%w x %h %x x %y\" mypic.jpg
1600 x 1200 72 PixelsPerInch x 72 PixelsPerInch
The resolution and units used are stored in the file, so if the resolution is stored in PixelsPerCentimeter, that's how identify
will display it. There isn't a way to do the conversion automatically through identify
. But it's just cm to inch conversion math:
PixelsPerInch = PixelsPerCentimeter * 2.54