RawTherapee as part of a workflow – Scripts and Command line II

RawTherapee and command line,
what can you expect from this article ?
Well, certainly not what you can find somewhere else.
Simple to understand instructions on how and where.
No examples that don’t work and no one can understand,
but only ( when the instructions have been followed ) working batch examples ( code in red )
Single command line batch files ( performing one command with RT only )
Multi command line batch files ( performing more than one command with RT )
Creating processing files ( pp3 ) for pré programming certain processing adjustments like exposure correction, sharpening etc.
And as Trey Radcliff likes to say, it will be a “living document”, so I will complement this article in time.
Later, when complete, I will publish the article in the workshop menu, where its more easy to find.

First step : if you want to run a command to start RawTherapee, whether its from a windows DOS box or from a batch file , you need to give the path to its executable ( rawtherapee.exe or just rawtherapee ) like :
C:\DARKROOM\RawTherapee_WinVista_64_4.2.363\rawtherapee.exe
But, its much easier to use a batch file placed in the root of the RawTherapee folder ( the root is where the rawtherapee.exe is ), then u only need to start your batch file with rawtherapee.exe folowed by developing parameters.
like :
rawtherapee.exe -j70 -o C:\folder\folder\*.dng -c C:\folder\folder\
This will develop all DNG files in a certain folder to Jpeg, with 70% compression, with default parameters, to a certain folder.
Because we need to change input and output folder, we need the batch file to ask us the path of both folders.
This is done by using the “set /p” command.
For example : set /p input=Enter Input parameter :
Ok, enough theory, lets set this into practice.

Run notepad or notepad++ ( http://portableapps.com/apps/development/notepadpp_portable )
and type: rawtherapee.exe
– save the file in the root of the RawTherapee folder ( if you name it rawtherapee, it will be close to the executable, and so more easy to find )
– change the extention from .txt to .bat
If you’ve done everything right, RawTherapee will start.
This is just to make sure you’re on the right track.
Then open the batch file again with a right mouse click and choose edit.
Change its contents to the folowing command :

set /p input=Enter Input parameter :
set /p output=Enter output parameter
rawtherapee.exe -j70 -o %output% -c %input%

Save and double click the batch file.
You should get this output when it starts (of course, the path will differ from situation) :

rt_batch_1

Enter the path of the RAW files you want to develop, and click enter

rt_batch_2

Then enter the path where you want the output ( the Jpeg’s ), and click enter

rt_batch_3

A second window will open from Rawtherapee,
In this window you can follow the development of each RAW file.
When the developent is finished, enter any key to close both open windows.

rt_batch_4

Now, you will find the developed Jpegs in the given folder.
If the program didn’t start, and it did in the first step, then you have probably made a typing mistake in one or both input/output path’s.
Start over until you get it right and working.
If it did work out just fine, you have made your first programming.
Congratulations !

Having this first step done, next programming will be much easier to understand and to follow.
Next step will be a simple interactive batch file with more parameters to define.

Now it’s getting interesting.
With the “set /p” command, we can virtually insert any command or option that is possible in RawTherapee.
It would be possible to write just one program line, that could perform any command.
But you also would need to enter a lot of parameters, and that would make it complicated.
The best option is to create one or more batch files that fit your purpose, or to create one fully interactive batch file, just like my RawBat.

Also, remember this when working with the “set /p” command :
– special characters mostly don’t work, so use normal words
– any word can be used, but use logical words according to what is needed
– use short and to the point questions after the “=” sign

Ok, now a series of script possibilities, starting with the Jpeg from before.
First, setting the -j70 where it should be ( between -o and -c ),
and then mixing options with interactive input ->

Same as before, but now at the correct place, Jpeg 70%

set /p input=Enter Input parameter :
set /p output=Enter output parameter :
rawtherapee.exe -o %output% -j70 -c %input%

Jpeg 70% in best quality

set /p input=Enter Input parameter :
set /p output=Enter output parameter :
rawtherapee.exe -o %output% -j70 -js3 -c %input%

Tif output 8 bit

set /p input=Enter Input parameter :
set /p output=Enter output parameter :
rawtherapee.exe -o %output% -t -b8 -c %input%

Tif output 16 bit

set /p input=Enter Input parameter :
set /p output=Enter output parameter :
rawtherapee.exe -o %output% -t -b16 -c %input%

Ask output format and quality

set /p input=Enter Input parameter :
set /p output=Enter output parameter :
set /p format=Jpeg/compression (-j10/100 ) or Tif ( -t ) :
set /p quality=Jpeg quality ( -js1/3 ) or Tif Bit depth ( -b8/16 ) :
rawtherapee.exe -o %output% %format% %quality% -c %input%

Ask output format, quality and load RawTherapee Natural1.pp3 profile from Generic profile folder
Caution : most RT existing profiles have a space in their filename,
and the batch script cannot work with spaces in filenames.
therefore, make a copy of the file and rename to Natural-1.pp3 for this example.
For any other profile you want to use, make sure the characters are connected !

set /p input=Enter Input parameter :
set /p output=Enter output parameter :
set /p format=Jpeg/compression (-j10/100 ) or Tif ( -t ) :
set /p quality=Jpeg quality( -js1/3 ) or Tif Bit depth ( -b8/16 ) :
rawtherapee.exe -o %output% %format% %quality% -p profiles\Generic\Natural-1.pp3 -c %input%

Same as above but now ask for profile to use

set /p input=Enter Input parameter :
set /p output=Enter output parameter :
set /p format=Jpeg/compression (-j10/100 ) or Tif ( -t ) :
set /p quality=Jpeg quality( -js1/3 ) or Tif Bit depth ( -b8/16 ) :
set /p profile=Define RT profile ( like default.pp3 or generic\natural-1.pp3 ) :
rawtherapee.exe -o %output% %format% %quality% -p profiles\%profile% -c %input%

Example

rt_batch_5

If you want a cleaner script when running,
add “@echo off” at the start of the script.

@echo off
set /p input=Enter Input parameter :
set /p output=Enter output parameter :
set /p format=Jpeg/compression (-j10/100 ) or Tif ( -t ) :
set /p quality=Jpeg quality ( -js1/3 ) or Tif Bit depth ( -b8/16 ) :
set /p profile=Define RT profile ( like default.pp3 or generic\natural-1.pp3 ) :
rawtherapee.exe -o %output% %format% %quality% -p profiles\%profile% -c %input%

rt_batch_6

To be continued

 

Comments are closed.