Just returned from cabin-in-the-woods, where I was able to code up an initial implementation of the ‘script’ tool. I used the ‘gmic’ tool code as a starting point, so it follows the same fundamental behavior: take the image from the previous tool in the chain, pass it as input to the script, and take the output of the script and present it to the next tool in the chain. ‘script’ does it with TIFFs, and runs the script program as a child process.
Using G’MIC and Imagemagick as examples, I wrote the tool to be configurable to an arbitrary number of script programs. All that’s required to use a particular scripting application is the definition of three rawproc propertries:
- script.[scriptprogram].command: The absolute path to the script program.
- script.[scriptprogram.commandstring: This is a template of the script command with fill-ins, looks like this:
[program] [infile] [script] output [outfile],float
This is my current template to run a gmic script. The [ ] are fillins, where rawproc replaces them with the values needed in the appropriates posistions of the script invocation.
- script.[scriptprogram].channelformat: 8bit|16bit|float|unboundedfloat
The [scriptprogram] part of the property name is ‘gmic’, ‘imagemagick’, whatever you want to use to identify the script program. rawproc uses these to populate a drop-down selector in the parameters pane"

To use the tool, one just selects one of the script programs in the drop-down, then selects a script file using the file selector presented by clicking “Select File…”. The selected file is used to populate the commandstring template, which is then executed as a child process. rawproc waits for the script process to terminate, then retrieves the result image and stores it as the result of the script tool.
Checking the ‘auto update’ checkbox makes rawproc automatically run the script whenever the script file is changed. That way, one can work the script and save it, and rawproc will update without any other action.
The script tool disposes of the temporary TIFFs by default, but they can be retained by checking the ‘retain files’ checkbox. The image files will be overwritten in the next invocation of the script, so if one really wants to retain either or both, they need to move them before this happens.
The TIFF saved by the script tool for input to the script invocation is the image being edited, at the state of the previous tool. If the TIFF format is float, the value range will be 0.0 - 1.0; if the format is 8bit|16bit, the data will be scaled proportionately to the integer boundaries.
When the output TIFF is read back into rawproc, it’ll be used to replace the input image. The original metadata and ICC profile associated with the input image is retained (except for image width and height, those values are updated). If the image was modified with respect to any of this data, the user is responsible for manually updating it in the toolchain.
For anyone wanting to try it out, here are my relevant properties:
script.gmic.command=C:\msys64\home\glenn\ImageStuff\gmic\src\gmic.exe
script.gmic.commandstring=[program] [infile] [script] output [outfile],float
script.imagemagick.channelformat=16bit
script.imagemagick.command=C:\msys64\mingw64\bin\convert.exe
script.imagemagick.commandstring=[program] [infile] [script] [outfile]