Is call to ImageInfo() required for SetNewValue()

Started by sjDelaney, May 11, 2016, 02:26:09 PM

Previous topic - Next topic

sjDelaney

Must you always call ImageInfo before SetNewValue when not testing for the existence or value of any tag?
Can I go straight to SetNewValue after creating a new Object without calling ImageInfo()?

        my $exifTool = new Image::ExifTool;     # Create a new exifTool Object
        $Info = ImageInfo($File,\@TagList);     # Open File and return tag list
       
        #   Set new values to Subject and HierarchicalSubject
        $exifTool->SetNewValue();               # Clear previously queued values
        $exifTool->SetNewValue('Subject' => $Subject);
        $exifTool->SetNewValue('HierarchicalSubject' => $Subject);
       
        #   Write to file
        my $Write = $exifTool->WriteInfo($File);

Phil Harvey

No, absolutely not.  If you are just writing you shouldn't be calling ImageInfo().

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).