Page 1 of 1

identify reports 299.999dpi while it is 300dpi

Posted: 2011-11-09T04:34:54-07:00
by leyn
Hello,

I have a Canon Lide scanner which I'm using
to save to color .png files. I set the resolution to
300dpi in both directions.

For some reason, I have to be able to ask up the resolution
after scanning. I do this with 2 programs:

1) IrfanView, info button: IrfanView correctly reports the 300dpi
in both directions.
2) identify -units PixelsPerInch -verbose filename.png
Here I get a resolution in both directions of
299.999dpi.

The idenfy behavior is very anoying: I need integers and not floats
in order to calculate some other parameters.

Why is identify reporting with a float, and can something
be done about this?

Best regards,

Francky Leyn

Re: identify reports 299.999dpi while it is 300dpi

Posted: 2011-11-09T06:33:17-07:00
by glennrp
The reason is that PNG stores the resolution in pixels/meter which can't
exactly represent dpi. Identify is simply reporting what it has.