Author Topic: ImageInfo on a specific tag fails if one file doesn't have that tag  (Read 1815 times)

bexelbie

  • Newbie
  • *
  • Posts: 5
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

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 15224
    • ExifTool Home Page
Re: ImageInfo on a specific tag fails if one file doesn't have that tag
« Reply #1 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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

bexelbie

  • Newbie
  • *
  • Posts: 5
Re: ImageInfo on a specific tag fails if one file doesn't have that tag
« Reply #2 on: December 04, 2017, 07:49:32 AM »
Thank you