"Fossies" - the Fresh Open Source Software Archive

Member "fly-2.0.1/examples/perl/size.pl" (25 Nov 2001, 590 Bytes) of package /linux/www/old/fly-2.0.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    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 }