Question
Is there an equivalent of deleteProperty(XMPConst.NS_DC, "description”) for EXIF:ImageDescription an
- February 15, 2023
- 2 replies
- 2640 views
I want to remove the tags/descriptions below from TIF, PSD and PSB images:
[EXIF:IFD0] .........ImageDescription
[XMP:XMP-dc].....Description
[IPTC]....................Caption-Abstract
I can do this with ExifTool with this code:
exiftool -m -overwrite_original_in_place -EXIF:ImageDescription= -XMP-dc:Description= -IPTC:Caption-Abstract=
Can anyone help me do this with a script on MacOS without using ExifTool?
I don’t have much coding experience, but I found the code below as a starting point without using Photoshop (though I don’t need to write anything to it as this code does… I’d prefer just to delete or wipe the tags/content so they don’t show up).
Sample Code without Photoshop/Bridge:
Code: Select allvar f = File("/c/captures/a.jpg");
setDescription(f,"My new description");
function setDescription( file, descStr ){
if ( !ExternalObject.AdobeXMPScript ) ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
var xmpf = new XMPFile( File(file).fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE );
var xmp = xmpf.getXMP();
xmp.deleteProperty(XMPConst.NS_DC, "description");
xmp.setLocalizedText( XMPConst.NS_DC, "description", null, "x-default", descStr );
if (xmpf.canPutXMP( xmp )) {
xmpf.putXMP( xmp );
}
xmpf.closeFile( XMPConst.CLOSE_UPDATE_SAFELY );
}
And here is some alternate partial code from within Photoshop when Opening a Document:
function removeDescription() {
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);
xmp.deleteProperty(XMPConst.NS_DC, "description");
app.activeDocument.xmpMetadata.rawData = xmp.serialize();
}
}
removeDescription();
