Get metadata using extendscript from raw file(.cr2,.cr3 etc) without opening the raw file
This works no problem with a jpeg however the same method doesn't work with a camera raw file.
https://community.adobe.com/t5/photoshop-ecosystem-discussions/get-print-dpi-resolution/m-p/10502704#M250043
I have also tried this but it only shows the first part of the metadata. I really don't know what to do. Essentially I just want to check if there is a rating greater than 0 in the metatdata of files in a folder without opening/closing each RAW file individually as it takes a lot of time. Any help would be much appreciated.
if (ExternalObject.AdobeXMPScript === undefined) {
ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
}
// Function to load XMP metadata from raw file
function loadXMPMetadata(rawFilePath) {
var xmpFile = new File(rawFilePath);
if (!xmpFile.exists) {
alert("Raw file does not exist: " + rawFilePath);
return;
}
// Read the XMP data from the file
xmpFile.open('r');
var xmpData = xmpFile.read();
xmpFile.close();
alert(xmpData)
// Create an XMPMeta object from the data
var xmp = new XMPMeta(xmpData);
var serializedXMP = xmp.serialize()
alert(serializedXMP)
}
