perlquestion
monsieur_champs
<p>Brothers</p>
<p>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.</p>
<p>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.</p>
<p>I'm using the
<a href="http://studio.imagemagick.org/www/perl.html">
PerlMagick</a> <a href="http://www.imagemagick.org/">
ImageMagick</a> Interface to this task.</p>
<p>To calculate the image size, I'm using this:</p>
<code>
# 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;
</code>
<p>Can anybody help me with this task?</p>
<p>May the [gods] bless you.</p>
<pre>
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Luis Campos de Carvalho
Just Another Perl Monk
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
</pre>