ExifTool Forum

ExifTool => The Image::ExifTool API => Topic started by: bexelbie on December 04, 2017, 03:51:09 AM

Title: ImageInfo on a specific tag fails if one file doesn't have that tag
Post by: bexelbie on December 04, 2017, 03:51:09 AM
This is probably a "you shouldn't write perl code late at night" error, however I don't see it.

---
use Image::ExifTool qw(:Public);
my @ioTagList;

foreach my $f (@ARGV) {
  my $info = ImageInfo($f, \@ioTagList, {Unknown => 1});
  print "Found this: $f => $$info{Apple_0x0011}\n";
  }
---

When called with a single file, this works as expected.  When called on a group of files, it works as expected until one file doesn't have this TAG (Apple_0x0011).  After that no more data for this TAG is ever returned.

Am I supposed to reset the ImageInfo call somehow?

Thanks,

bex
Title: Re: ImageInfo on a specific tag fails if one file doesn't have that tag
Post by: Phil Harvey on December 04, 2017, 07:13:06 AM
This is because ioTagList is updated with the returned tags.  You must re-initialize this list with the tag you want to extract before each call to ImageInfo().

- Phil
Title: Re: ImageInfo on a specific tag fails if one file doesn't have that tag
Post by: bexelbie on December 04, 2017, 07:49:32 AM
Thank you