[Originally posted by 00coday on 2005-12-13 16:06:31-08]
Is there a way to clear XMP data from a JPG file without having to set all of the tags to ''? When the tags are set to '' there is no data to display, but the tags are still there with empty values which keeps photoshop from looking elsewhere for metadata. Is it possible to remove the tags alltogether?
[Originally posted by exiftool on 2005-12-13 16:40:37-08]
I'm not sure I understand the problem. ExifTool does clear the information as you want.
Are you using the API or the exiftool script?
With the exiftool script, tags are deleted if you set the value to ''
With the API, you call SetNewValue() with an undefined value to delete the tag.
If you want to delete all of the XMP information, use '-xmp:all=' with the exiftool script
[Originally posted by 00coday on 2005-12-13 16:58:46-08]
I run the following script to clear XMP data:
##---------------------------------------------------------------------
## Clear XMP Fields
##---------------------------------------------------------------------
sub ClearXMP(){
$exifTool->SetNewGroups('XMP');
$exifTool->SetNewValue('XMP-dc:Title' => '');
$exifTool->SetNewValue('XMP-photoshop:Urgency' => '0');
$exifTool->SetNewValue('XMP-photoshop:SupplementalCategories' => '');
$exifTool->SetNewValue('XMP-dc:Subject' => '');
$exifTool->SetNewValue('XMP-photoshop:Instructions' => '');
$exifTool->SetNewValue('XMP-dc:creator' => '');
$exifTool->SetNewValue('XMP-photoshop:AuthorsPosition' => '');
$exifTool->SetNewValue('XMP-photoshop:City' => '');
$exifTool->SetNewValue('XMP-photoshop:State' => '');
$exifTool->SetNewValue('XMP-photoshop:Country' => '');
$exifTool->SetNewValue('XMP-photoshop:Headline' => '');
$exifTool->SetNewValue('XMP-photoshop:Credit' => '');
$exifTool->SetNewValue('XMP-photoshop:Source' => '');
$exifTool->SetNewValue('XMP-dc:Description' => '');
$exifTool->SetNewValue('XMP-photoshop:CaptionWriter' => '');
$exifTool->SetNewValue('XMP-photoshop:TransmissionReference' => '');
$exifTool->SetNewValue('XMP-photoshop:Category' => '');
$iUpdate = $exifTool->WriteInfo("$imagePath$file","$imagePath.$file",'XMP');
if($iUpdate > 0){
system("move /Y $imagePath.$file $imagePath$file");
} else {
print "XMP Clear Failed image->$imagePath$file\n";
}
}
When I write data back to the XMP I get the following:
XMP DATA
------------------------------------------------
AuthorsPosition :
CaptionWriter : CHIEF YEOMAN ALPHONSO BRAGGS
Category :
City : ARTIC CIRCLE
Country :
Creator : , CHIEF YEOMAN ALPHONSO BRAGGS
Credit :
DateCreated : 2004:01:15
Description : As seen through the periscope of the
Los Angeles-class fast attack submarine USS HONOLULU (SSN 718), a polar bear inv
estigates the open water around the submarine's rudder, while surfaced 280 miles
from the North Pole in the Artic Circle, Oct. 2003. Commanded by Cmdr. Charles
Harris, HONOLULU while conducting otherwise classified operations in the Arctic,
collected scientific data and water samples for U.S. and Canadian Universities
as part of an agreement with the Artic Submarine Laboratory (ASL) and the Nation
al Science Foundation (NSF). HONOLULU is the 24th Los Angeles-class submarine,
and the first original design in her class to visit the North Pole region. HONO
LULU is as assigned to Commander Submarine Pacific, Submarine Squadron Three, Pe
arl Harbor, Hawaii. (U.S. Navy photo by Chief Yeoman Alphonso Braggs) (Released
)
Headline :
Instructions : credit as U.S Navy photo by Alphonso Braggs
Source : NAVY VISUAL NEWS SERVICE
State :
Subject : , NAVY ,POLAR BEARS ,SSN 718 ,UNCLASS, IFIED ,USS HONLULU
SupplementalCategories :
Title : 0310XX-N-XXXXB-002
TransmissionReference :
Urgency : 0
The following fields are displayed, but contain no data:
AuthorsPosition
Category
Country
Credit
Headline
State
SupplementalCategories
TransmissionReference
Any Ideas?
[Originally posted by exiftool on 2005-12-13 17:04:18-08]Ah, yes. Crystal clear now. Thanks.
The problem is that you have to do this:
$exifTool->SetNewValue('XMP-dc:Title' => undef);
instead of
$exifTool->SetNewValue('XMP-dc:Title' => '');
to delete the information.
[Originally posted by exiftool on 2005-12-13 17:11:13-08](or more simply:
$exifTool->SetNewValue('XMP-dc:Title');
which corresponds to the example given for deleting a tag in the SetNewValue() documentation.)
[Originally posted by 00coday on 2005-12-13 17:27:38-08]
My apologies for not examining the docs more closely. Thanks for the help.