1

Photoshop2020 seems to have EXR support. I can't find in the scripting reference of PS2019 any mention though of how to save EXR files and I also couldn't find a scripting reference for the 2020 version of Photoshop.

Does someone know where to find the 2020 scripting reference or how to save EXR from script?

1

You can use ScriptingListener code to save an EXR:

saveEXR('/D/temp/mydfile.exr');

/**
 * @description saves EXR using Photoshop EXR Export
 * @param  {string} path    - a full path of exr to save as a string, ex /c/temp/myfile.exr
 * @param  {object} options - if you want to add any options
 *
 * @return nothing
 */
function saveEXR(path, options)
{
  var desc5 = new ActionDescriptor();
  var desc6 = new ActionDescriptor();
  desc6.putInteger(charIDToTypeID('BtDp'), 16);
  desc6.putInteger(charIDToTypeID('Cmpr'), 0);
  desc6.putInteger(charIDToTypeID('AChn'), 0);
  desc5.putObject(charIDToTypeID('As  '), charIDToTypeID('EXRf'), desc6);
  desc5.putPath(charIDToTypeID('In  '), new File(path));
  executeAction(charIDToTypeID('save'), desc5, DialogModes.NO);
} // end of saveEXR()

However Photoshop support for EXR is very basic and you might want to use something like EXR-IO. Here's its export wrapped to a function:

saveEXRIO('/D/Temp/whatevs.exr');

/**
 * @description saves EXR using EXR-IO plugin
 * @param  {string} path    - a full path of exr to save as a string, ex /c/temp/myfile.exr
 * @param  {object} options - here you'll probably want to modify the options
 *
 * @return nothing
 */
function saveEXRIO(path, options) {
    var desc14 = new ActionDescriptor();
    var desc15 = new ActionDescriptor();
    desc15.putBoolean(charIDToTypeID('iolc'), false);
    desc15.putBoolean(charIDToTypeID('iowt'), false);
    desc15.putBoolean(charIDToTypeID('iohl'), false);
    desc15.putBoolean(charIDToTypeID('iosl'), true);
    desc15.putBoolean(charIDToTypeID('iosw'), true);
    desc15.putInteger(charIDToTypeID('iocs'), 2);
    desc15.putInteger(charIDToTypeID('iotw'), 128);
    desc15.putInteger(charIDToTypeID('ioth'), 128);
    desc15.putDouble(charIDToTypeID('iocl'), 45.000000);
    desc15.putString(charIDToTypeID('iodt'), "LOAT");
    desc15.putString(charIDToTypeID('ioct'), "ip");
    desc15.putString(charIDToTypeID('iotl'), "ingle");
    desc14.putObject(charIDToTypeID('As  '), stringIDToTypeID('3d-io Exr-IO'), desc15);
    desc14.putPath(charIDToTypeID('In  '), new File(path));
    executeAction(charIDToTypeID('save'), desc14, DialogModes.NO);
} // end of saveEXRIO()

To learn what options do what you can experiment with Scripting Listener.


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.