Copy link to clipboard
Copied
Aparently standing on the shoulders of giants is harder than it would appear...
I have attempted to modify the following code to remove Adobe Camera Raw “develop” metadata from a JPG or TIFF, however it does not work. Can anybody point a rookie in the right direction? The end result should be the same as using Bridge’s “right click on file > develop settings > clear settings” command. I believe that my error is in line 12 where I would like to remove all of the "crs" metadata as a block:
// https://forums.adobe.com/message/9671488#9671488
#target photoshop;
var inputFolder= Folder.selectDialog ("Please select folder to process");
if(inputFolder != null){
var fileList = inputFolder.getFiles(/\.(jpg|tif)$/i);
for(var a in fileList){clearSettings(fileList);}
}
function clearSettings(selectedFile) {
if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
var xmpFile = new XMPFile( selectedFile.fsName, XMPConst.FILE_UNKNOWN, XMPConst.OPEN_FOR_UPDATE | XMPConst.OPEN_USE_SMART_HANDLER );
var xmp = xmpFile.getXMP();
xmp.deleteProperty(XMPConst.NS_CAMERA_RAW, "crs");
if (xmpFile.canPutXMP(xmp)) {
xmpFile.putXMP(xmp);
xmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
}
};
P.S. There is a Bridge script to do this, however the requirement is to do so from Photoshop.
Here you are Steven...
#target photoshop; | ||
var inputFolder= Folder.selectDialog ("Please select folder to process"); | ||
if(inputFolder != null){ | ||
var fileList = inputFolder.getFiles(/\.(jpg|tif|psd)$/i); | ||
for(var a in fileList){delFileAncestorsMeta(fileList);} | ||
} | ||
function delFileAncestorsMeta(selectedFile) { | ||
if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript"); | ||
var xmpFile = new XMPFile( selectedFile.fsName, XMPConst.FILE_ |
Copy link to clipboard
Copied
Here you are Steven...
#target photoshop; | ||
var inputFolder= Folder.selectDialog ("Please select folder to process"); | ||
if(inputFolder != null){ | ||
var fileList = inputFolder.getFiles(/\.(jpg|tif|psd)$/i); | ||
for(var a in fileList){delFileAncestorsMeta(fileList);} | ||
} | ||
function delFileAncestorsMeta(selectedFile) { | ||
if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript"); | ||
var xmpFile = new XMPFile( selectedFile.fsName, XMPConst.FILE_UNKNOWN, XMPConst.OPEN_FOR_UPDATE | XMPConst.OPEN_USE_SMART_HANDLER ); | ||
var xmp = xmpFile.getXMP(); | ||
XMPUtils.removeProperties(xmp,XMPConst.NS_CAMERA_RAW, "", XMPConst.REMOVE_ALL_PROPERTIES); | ||
if (xmpFile.canPutXMP(xmp)) { | ||
xmpFile.putXMP(xmp); | ||
xmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY); | ||
} | ||
}; |
Copy link to clipboard
Copied
Thanks SuperMerlin, as always your on the money!
Copy link to clipboard
Copied
Supermerlin
I tried your script on mac with high sierra
photoshop cc2018
does not work
nothing is happening
how can you solve it?
Copy link to clipboard
Copied
How are you verifying that the metadata is not being removed?
What file format? Is this a JPEG or TIFF? Was the CRS metadata applied in Bridge by opening into ACR, adjusting and then pressing done? Or was the file saved from ACR “baking in” the applied metadat? Or something else?
Copy link to clipboard
Copied
I opened the nef in the raw room
I saved in jpg
I uploaded the .jsx file
indicating the folder where e
present the jpg file the nef file and the .xmp file
I do not know if I'm wrong?
Copy link to clipboard
Copied
OK, so the metadata has been saved into the JPEG save from the raw file.
Is the filename extension .jpg or .jpeg?
The script is only processing files with an exact extension of JPG | TIF | PSD (upper or lower case does not matter). You may need to add in TIFF and JPEG versions if there are variations in filename extension. NEF and XMP are not processed.
In Bridge or Photoshop, you can use File > File Info then look on the Raw Data tab for the following CRS entries:
<crs:Version>10.5</crs:Version>
<crs:ProcessVersion>10.0</crs:ProcessVersion>
<crs:WhiteBalance>As Shot</crs:WhiteBalance>
<crs: etc...
Copy link to clipboard
Copied
ok after I see how it goes
thank you