Copy link to clipboard
Copied
Hey,
Im trying to open a raw file without any settings. I can reset most of them with CameraRawOpenOptions but I still need to reset the crop and various brushes used in camera raw previously. Is there a way to open without the xmp or any other way to do this?
Thanks a lot!
1 Correct answer
This will only work on raw files that have the xmp sidecar and not dngs. The code below has a hard coded filename, but you can swap that out with a get statement to get a list of file names, then loop through that. There is an ending if statement to return the xmp to the original name.
...#target photoshop
var file = new File('/c/Photos/test.RAF');
var fileXMP = new File(file.fsName.split('.')[0] + '.xmp');
if(fileXMP.exists){
var originalName = fileXMP.name.split('.')[0];
fileXMP.rename(original
Explore related tutorials & articles
Copy link to clipboard
Copied
I'm not sure if there's code to do what you want, but you could rename the xmp file then open the image file, so there is no xmp data associated with the file. You could then rename it back to it's original name, if you want to keep any original corrections.
Copy link to clipboard
Copied
Another option would be to use ExifTool to remove the ACR data from the XMP sidecar file:
Mac OS:
exiftool -XMP-crs:all= '/mac os/path/to/file.xmp'
Win OS:
exiftool -XMP-crs:all= "C:\Users\Username\Path to\file.xmp"
Copy link to clipboard
Copied
Thanks!
Is there an option to remove/rename the xmp file (or clear it of the content) from photoshop via scripting? Unfortunately can't exif tool be used since this will be run on several computers.
Copy link to clipboard
Copied
This will only work on raw files that have the xmp sidecar and not dngs. The code below has a hard coded filename, but you can swap that out with a get statement to get a list of file names, then loop through that. There is an ending if statement to return the xmp to the original name.
#target photoshop
var file = new File('/c/Photos/test.RAF');
var fileXMP = new File(file.fsName.split('.')[0] + '.xmp');
if(fileXMP.exists){
var originalName = fileXMP.name.split('.')[0];
fileXMP.rename(originalName + '(orig).xmp');
}
var doc = open(file);
if(fileXMP.exists){
fileXMP.rename(originalName + '.xmp');
}
Copy link to clipboard
Copied
Thanks a lot Chuck,
This is exactly what I'm looking for. Just tried it out and it works like a charm.
Cheers
Copy link to clipboard
Copied
Great, glad it worked for you.

