如何通过Perl模块获取图像的元数据? [英] How can you get the metadata of an image by the Perl module?
本文介绍了如何通过Perl模块获取图像的元数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我通过MacPorts安装了以下组件:
I installed the following component by MacPorts:
p5-image-info @1.16 (perl, graphics)
Extract meta information from image files
在其网站中说,您可以使用通过
It says in its website that you can use it by
Usage is something like this:
use Image::Info qw(image_info);
@info = image_info("filename");
$refto_hash_describing_1st_image = $info[0];
$refto_hash_describing_2nd_image = $info[1];
但是,我跑步失败
$perl use Image::Info qw(image_info);
-bash: syntax error near unexpected token `('
$
如何通过Perl模块获取图像的元数据?
推荐答案
描述的语法是您如何在Perl脚本中使用它,不是如何将其作为单行代码使用.外壳.
The syntax described is how you would use it within a Perl script, not how you can use it as a single line from the shell.
将其放入.pl文件中(例如"image_info.pl"):
Put this in a .pl file (e.g. "image_info.pl"):
#!/usr/bin/perl -w
use strict;
use Image::Info qw[image_info];
use Data::Dumper;
while (@ARGV) {
print Dumper(image_info(shift));
}
然后运行它:
$ ./image_info.pl file.jpg
陶醉其中,它将告诉您...
and revel in the masses of information it will tell you...
这篇关于如何通过Perl模块获取图像的元数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文