HylaFAX The world's
most advanced open source fax server
|
|
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
Re: [hylafax-users] tiff image dimensions measurement unit
> What is the measurement unit used by tiffinfo to reports the
> Image Width and Image Length of the tiff files created by Hylafax?
>
> It doesn't seem to be milimeters nor inches nor pixels...
It is inches...
Although, you did not ask for it, I thought someone might find it
useful. Following are a set of pretty-well tested routines that use
tiffinfo to determine if a given tiff is 'faxable'. As you can see, the
measurement is in Inches.
The check_corruption thing is very interesting...If anyone has
information on this, please post - although I determined the failure, I
do not understand it...
<snip>
my $required_format = "8.5 x 11.0";
sub check_dimensions {
my( $file ) = @_;
my $ret = `tiffinfo "$file" 2>/dev/null`;
my ($width, $height, $xres, $yres ) = (0,0,300,300);
($width, $height)=($1,$2)
if( $ret =~ /Image Width: (\d+) Image Length: (\d+)/ );
($xres, $yres)=($1,$2)
if( $ret =~ /Resolution: (\d+),(\d+)/ );
$xres=300 if( !$xres );
$yres=300 if( !$yres );
my $format = sprintf "%0.1f x %0.1f",
$width/$xres, $height/$yres;
my $errstr =
( $format ne $required_format ) ?
"$file badly formated.\n" .
"\tRequired Dimensions $required_format\n" .
"\tActual Dimensions $format\n" : '';
my $errstr .= check_corruption($file);
return $errstr;
}
# corruption - something of a rediculously vague term is used here
# becuase it is a vague problem with disasterous results. If one of
# our tiffs contains 'Extra Samples' it will not convert to ps correctly
# and therefore will not fax, or do anything worthwhile. This subroutine
# facilitates checking of this problem.
sub check_corruption($){
my $file = shift;
my $ret = "tiffinfo $file 2>&1 | grep \"Extra Samples\" | cut
-b18";
$ret = `$ret`;
if($ret =~ /1/){ return "$file contains extra samples and is
corrupted, please re-create\n"; }
}
</snip>
you would use this like:
my $err = check_dimensions($filename);
die ("Bad Format: $err") if($err);
--
-------------------------------------------
| Caleb Phillips |
| The Studio Resource |
| IT Specialist |
| |
| Handcrafted for you in Ximian Evolution |
-------------------------------------------
____________________ HylaFAX(tm) Users Mailing List _______________________
To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx < /dev/null
*To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxxxxx*