Image-ExifTool - IPTC XMP EXIF Clearing and Writing issues

Posted on Tue Oct 24 02:54:23 2006 by 00coday
IPTC XMP EXIF Clearing and Writing issues
I am trying to clear all IPTC/XMP/EXIF data from an image and write in only the information I want. I am using the following to clear the metadata
$exifTool->SetNewGroups('XMP'); $exifTool->SetNewValue('XMP:all' => undef); $exifTool->SetNewGroups('IPTC'); $exifTool->SetNewValue('IPTC:all' => undef); $exifTool->SetNewGroups('EXIF'); $exifTool->SetNewValue('EXIF:all' => undef); $update=$exifTool-> WriteInfo("$basedir\\@record[1].jpg","$basedir\\@record[1]x.jpg");

and it works great. I then rename the file back to the original. The problem comes when I try to write back to the file. I am using:
$exifTool-> SetNewGroups('IPTC'); $exifTool-> SetNewValue('IPTC:ObjectName' => 'test data'); $update=$exifTool-> WriteInfo("$basedir\\$record[1].jpg","$basedir\\$record[1]x.jpg",'IPTC');

Neither perl or ExifTool report an error, but no data is written to the file. I am assuming that clearing the data the way I am will actually remove the spots in the file where it is supposed to reside, so there is nowhere to write to. I tried using the following:
$exifTool->SetNewGroups('XMP'); $exifTool->SetNewValue('XMP:all' => ''); $exifTool->SetNewGroups('IPTC'); $exifTool->SetNewValue('IPTC:all' => ''); $exifTool->SetNewGroups('EXIF'); $exifTool->SetNewValue('EXIF:all' => ''); $update=$exifTool->WriteInfo("$basedir\\@record[1].jpg","$basedir\\@record[1]x.jpg");

but I get a "Can't set value for all tags" error which comes from the date fields. Any thoughts on how to quickly clear all IPTC-XMP-EXIF fields without having to do them one by one and still be able to write to the resulting file?
Write a response