Using EXIFTOOL I found that the data I'm looking to remove is in 3 tags:
- [EXIF:IFD0] ImageDescription
- [XMP:XMP-dc] Description
- [IPTC] Caption-Abstract
EXIFTOOL can remove with the code below:
Code: Select all
exiftool -m -overwrite_original_in_place -EXIF:ImageDescription= -XMP-dc:Description= -IPTC:Caption-Abstract= FILE
I've got it partially right... when I try to run the script below via the Photoshop Script Events "On Document Open" to remove the data, it works properly on a TIF and PNG (removing from all 3 fields), but I have to run it through twice (Open-Save-Close-Open-Save) to get it removed on a corresponding PSD, PSB or JPG.
If it helps diagnose, I see in EXIFTOOL this data is reported under EXIF:ImageDescription, XMP-dc:Description and IPTC:caption-abstract. To remove via EXIFTOOL, I had to remove all 3 per the code above.
Using the Photoshop script below:
* Before Running: the same data shows up under IFD0:ImageDescription, XMP-dc:Description and IPTC:caption-abstract
* After First Time: data still shows up under XMP-dc:Description (only for PSD/PSB/JPG; it's cleared for TIF/PNG)
* After Running Second Time: description and data is removed as I'd like on all formats
How could I fix this to completely remove the description field on the PSB/PSD/JPGs on the first try?
Code: Select all
function removeMetadata() {
whatApp = String(app.name);
if(whatApp.search("Photoshop") > 0) {
if(!documents.length) {
alert("There are no open documents. Please open a file to run this script.")
return;
}
if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
var xmp = new XMPMeta( activeDocument.xmpMetadata.rawData);
if (xmp.doesArrayItemExist(XMPConst.NS_DC, "description", 1))
{
xmp.deleteArrayItem(XMPConst.NS_DC, "description", 1);
}
app.activeDocument.xmpMetadata.rawData = xmp.serialize();
debugger
}
}
removeMetadata();