Skip to main content
Participant
June 9, 2017
Answered

Open raw file without settings

  • June 9, 2017
  • 4 replies
  • 984 views

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!

This topic has been closed for replies.
Correct answer Chuck Uebele

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');

    }   

4 replies

Chuck Uebele
Community Expert
Chuck UebeleCommunity ExpertCorrect answer
Community Expert
June 10, 2017

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');

    }   

AnderloAuthor
Participant
June 10, 2017

Thanks a lot Chuck,

This is exactly what I'm looking for. Just tried it out and it works like a charm.

Cheers

Chuck Uebele
Community Expert
Community Expert
June 10, 2017

Great, glad it worked for you.

AnderloAuthor
Participant
June 10, 2017

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.

Stephen Marsh
Community Expert
Community Expert
June 10, 2017

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"

Chuck Uebele
Community Expert
Community Expert
June 9, 2017

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.