1 #!/usr/local/bin/perl 2 # 3 # Simple script using fly to find the dimensions of an image. 4 # 5 # Martin Gleeson, January 1996 6 # 7 8 if( ! $ARGV[0] ) { 9 print STDERR "Usage: size <GIF image>\n"; 10 exit(0); 11 } 12 foreach $arg (@ARGV) { 13 open(FLY,"> /tmp/fly.$$"); 14 print FLY "existing $arg\n"; 15 print FLY "sizex\n"; 16 print FLY "sizey\n"; 17 close(FLY); 18 19 open(OUT, "fly -i /tmp/fly.$$ -o /dev/null |"); 20 while(<OUT>) { 21 ($x) = /is\ (\d+)$/ if /Size\ -\ X/; 22 ($y) = /is\ (\d+)$/ if /Size\ -\ Y/; 23 } 24 close(OUT); 25 26 print "Dimensions of $arg: $x by $y\n"; 27 undef($x);undef($y); 28 }