linello
linello

Reputation: 8704

Getting PDF size in millimeters with image-magick on Linux

Is there some image-magick tool to get the size of a PDF file in millimeters? I've tried with the imagemagick "identify" tool but the informations are only in pixels. How can I specify to output the information in millimeters together with the DPI?

Upvotes: 0

Views: 1746

Answers (2)

emcconville
emcconville

Reputation: 24419

Take a look at the first dozen lines of identify -verbose. It should list the following info.

  • Geometry
  • Resolution
  • Print size
  • Units

The Print size can be converted to mm easily, or found via google quickly.

For example...

identify -verbose document.pdf | head -12

Which returns

Image: /full/path/to/document.pdf
  Format: PDF (Portable Document Format)
  Mime type: application/pdf
  Class: DirectClass
  Geometry: 792x612+0+0
  Resolution: 72x72
  Print size: 11x8.5
  Units: Undefined
  Type: TrueColorAlpha
  Endianess: Undefined
  Colorspace: sRGB
  Depth: 16/8-bit

So about 25.4 mm per inch will result in

11 * 25.4 = 279.4mm
8.5 * 25.4 = 215.9mm

Of course YMMV if the PDF is a non-traditional page-size.

Upvotes: 2

Bonzo
Bonzo

Reputation: 5299

If you know the size in pixel you then need to decide if they are pixels/inch or pixels/mm and you can then do a calculation.

Upvotes: 0

Related Questions