Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to remove XMP data? Some namespaces apparently read-only

LEGEND ,
Feb 01, 2023 Feb 01, 2023

I have been banging my head against the wall to write a script that removes EXIF, EXIFEX, and EXIF-AUX data from files. I'm using Bridge 2022 and Photoshop 2023.

After numerous attempts, what happens is that Bridge will run a script flawlessly and APPEAR to have removed data, but purging cache or opening a file in a different application shows that it didn't happen.

var Thumbs = app.document.selections; //apply to all selected thumbs
if(ExternalObject.AdobeXMPScript == undefined)  ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript'); //load library for metadata
            
for(var a in Thumbs){
try{
if(Thumbs[a].hasMetadata){
var ThumbsMeta = Thumbs[a].synchronousMetadata; //get metadata
var ThumbsXMP = new XMPMeta(ThumbsMeta.serialize());
XMPUtils.removeProperties(ThumbsXMP, '', '', XMPConst.REMOVE_ALL_PROPERTIES);           
var ThumbsUpdatedPacket = ThumbsXMP.serialize();//XMPConst.SERIALIZE_USE_COMPACT_FORMAT); //update metadata object
Thumbs[a].metadata = new Metadata(ThumbsUpdatedPacket); //write to file
}
}
catch(e){
alert(e + ' ' + e.line);
}
}
            

 

This script should remove everything. Run it on a JPEG and look at what Bridge reports, then purge cache and look again. Complete fail.

 

This is a comparable Photoshop script, open a JPEG and run this then take a look.

if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
var xmp = new XMPMeta(activeDocument.xmpMetadata.rawData);
XMPUtils.removeProperties(xmp, "", "", XMPConst.REMOVE_ALL_PROPERTIES);
app.activeDocument.xmpMetadata.rawData = xmp.serialize();

 

I have tried numerous variations on this, I have a much longer script where I try to delete only parts of these namespaces. WTF? Is this by design, that a bunch of metadata is read-only but Bridge caches it as if it was actually processed?

TOPICS
Bug , Problem or error , Scripting
571
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 20, 2023 Feb 20, 2023
LATEST

After banging my head against this for quite a while, I've concluded that Adobe simply has not documented what works and what does not.

Bridge via ScriptUI/Extendscript will not remove a number of namespaces or the data in them. I finally ended up using EXIFTool with the following command:

 

exiftool -XMP-exifEX:All= -XMP-aux:All= -EXIFIFD:LensInfo= -EXIFIFD:SerialNumber= -EXIFIFD:LensModel= -XMP-xmpMM:All= -overwrite_original -ext jpg -recurse <directory>

 

This command removes the EXIF-EX, XMP-AUX, and XMP-MM namespaces and deletes specific tags from EXIF-IFD. It will recursively serach through folders, overwrite original files rather than creating new ones (I have good backups, just in case) and will only touch .jpg files.

 

I consider the current XMP support (looking like data is removed when it really isn't) to be a bug.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines