gifimage.sum

来自「harvest是一个下载html网页得机器人」· SUM 代码 · 共 56 行

SUM
56
字号
: # *-*-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 contentsdie("gifinfo $giffile: $!\n")	unless open(SUMMARY, "gifinfo $giffile|");$ok = 0;while (<SUMMARY>) {    chop;    ($attribute, $value) = split(/:/);    &print_av($attribute, $value);    $ok++;}close(SUMMARY);exit(1) unless ($ok);# Then create a thumbnail version of the GIF filedie("$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 = <T>;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/);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?