: # *-*-perl-*-* eval 'exec perl -S $0 "$@"' if $running_under_some_shell; @F = split('/', $0); $prog = pop @F; undef @F; die("usage: $prog gif-file\n") unless ($#ARGV == 0); $giffile = shift; $TMPDIR = $ENV{'TMPDIR'}; $TMPDIR = '/tmp' if ($TMPDIR eq ''); # First summarize the GIF file contents die("gifinfo $giffile: $!\n") unless open(SUMMARY, "gifinfo $giffile|"); $ok = 0; while () { chop; ($attribute, $value) = split(/:/); &print_av($attribute, $value); $ok++; } close(SUMMARY); exit(1) unless ($ok); # Then create a thumbnail version of the GIF file die("$TMPDIR: $!\n") unless chdir($TMPDIR); $cmd1 = "giftopnm $giffile"; $cmd2 = "pnmscale -width 64 -height 64"; $cmd3 = "ppmquant 256"; $cmd4 = "ppmtogif"; $cmd = join (" | ", $cmd1, $cmd2, $cmd3, $cmd4); die("$cmd: $!\n") unless open (T, "$cmd|"); undef $/; $gifdata = ; close T; &print_av ('thumbnail-data', $gifdata); exit 0; sub print_av { local ($a, $v) = @_; $l = length($v); print "$a{$l}:\t" . $v . "\n" if ($l > 0 && $a !~ /\s/); }