Brothers

I'm building a system to crop, resample and scale TIFF images from a Fax server, so it fit into a set of A4 (210x297mm) pages.

However I'm facing a strange problem: I don't know for sure how to calculate the size of a Image in millimeters. My calculations simply don't correspond to what I'm expecting, except when the resolution is 72dpi.

I'm using the PerlMagick ImageMagick Interface to this task.

To calculate the image size, I'm using this:

# A4 page height in inches (approximately) use constant PAGE_HEIGHT => 11; # A4 page width in inches (approximately) use constant PAGE_WIDTH => 8; my $image= new Image::Magick(); $image->Read( 'filename.tif' ); $vertical_size = $image->Get( 'y-resolution' ) * PAGE_HEIGHT; $horizontal_size = $image->Get( 'x-resolution' ) * PAGE_WIDTH;

Can anybody help me with this task?

May the gods bless you.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Luis Campos de Carvalho
Just Another Perl Monk
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

In reply to PerlMagick: How to Calculate an image size in milimiters? by monsieur_champs

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.