#!/usr/local/bin/perl
#
#  Simple script using fly to find the dimensions of an image.
#
#  Martin Gleeson, January 1996
#

if( ! $ARGV[0] )
{
        print STDERR "Usage: size <GIF image>\n";
        exit(0);
}

open(FLY,"> /tmp/fly.$$");
print FLY "existing $ARGV[0]\n";
print FLY "sizex\n";
print FLY "sizey\n";
close(FLY);

open(OUT, "fly -i /tmp/fly.$$ -o /dev/null |");

while( <OUT> )
{
      ($x) = /is\ (\d+)$/ if /Size\ -\ X/;
      ($y) = /is\ (\d+)$/ if /Size\ -\ Y/;
}

close(OUT);

print "Dimensions of $ARGV[0]: $x by $y\n";
