我使用图像::ExifTool为我的exif-需求。
但是现在,只需要检测图像是否有EXIF数据,而Image::ExifTool总是返回一些数据(例如,也从文件stat返回元数据,以及内部图像检测)。所以,
#!/usr/bin/perl
use 5.014;
use warnings;
use open qw(:std :utf8);
use Image::ExifTool qw(:Public);
use Data::Dumper;
my $ext = new Image::ExifTool;
while(<>) {
chomp;
next unless(-f $path);
if( $ext->ExtractInfo($path) ) {
say "$_" for (sort $ext->GetFoundTags());
}
else {
say "NO\t$path";
}
}打印许多“找到”标签,但文件不包含任何exif信息。
在这里提供了一些简单的方法来检测比图像实际是否有EMBEDEDD exif数据的图像::ExifTool?
如果某人需要更多的信息:拥有和使用exif数据的img.jpg图像,所以:
$ exif --list-tags --no-fixup img.jpg
#or
$ identify -format '%[exif:*]' img.jpg打印许多标签。现在
$ cp img.jpg img2.jpg
$ mogrify -strip img2.jpg #removing all exif data, so
$ exif --list-tags --no-fixup img2.jpg版画
Corrupt data
The data provided does not follow the specification.
ExifLoader: The data supplied does not seem to contain EXIF data.和
$ identify -format '%[exif:*]' img2.jpg什么都没印。所以img2.jpg没有exif数据。但是上面的perl脚本仍然打印许多“找到”标记。
发布于 2013-06-25 12:45:02
尝试调用$ext->GetInfo(' EXIF :*')只获取EXIF信息。
https://stackoverflow.com/questions/17283063
复制相似问题