rawtherapee-cli result

Hi.
I want to use rawtherapee-cli.exe for processing photo from my Windows console.
The problem is when I call rawtherapee.cli.exe it creates another process that does the processing.

How can I find this process, wait for completion and get result?
How can I call rawtherapee-cli.exe like any usual console program, read it’s output and exit code?

Would parameter -w be of any assistance?
See Command-Line Options - RawPedia

No, because the parameter “-w” only hides ui window.

I don’t know why, but:

if I execute bat-file with content like this:

rawtherapee-cli.exe -w -o 1.jpg -c 1.cr2 rawtherapee-cli.exe -w -o 2.jpg -c 2.cr2 rawtherapee-cli.exe -w -o 3.jpg -c 3.cr2

it will execute all processings sequentially. It is normal behavior.

But if I execute these lines in command prompt one after another, 3 instances of rawtherapee-cli.exe will be executed in parallel. Command prompt doesn’t wait for process exit.

Maybe use
call rawtherapee-cli.exe ...

Edit: Scratch that. It’s exactly not what you want…

What Win version are you on?
Back in the XP days, this would work:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds_shelloverview.mspx?mfr=true

I guess we have to build the rawtherapee-cli.exe without the -mwindows switch.
@gaaned92 or @TooWaBoo Could you take a look, please?

Edit, @gaaned92 or @TooWaBoo , could you try this patch:

diff --git a/win.cmake b/win.cmake
index 0a32ac95..3b330ebe 100644
--- a/win.cmake
+++ b/win.cmake
@@ -30,8 +30,8 @@ set(PROC_TARGET_NUMBER 0 CACHE STRING "Target Processor")
 # CMAKE_C_FLAGS and CMAKE_EXE_LINKER_FLAGS to select between 32/64bit build
 set(CMAKE_CXX_FLAGS "-mwin32 -m64 -mthreads -msse2" CACHE STRING "Compiler options for C++ source files")
 set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g2" CACHE STRING "Compiler options for C++ source files and Debug target")
-set(CMAKE_CXX_FLAGS_RELEASE "-mwindows -Wno-aggressive-loop-optimizations -DNDEBUG -O3" CACHE STRING "Compiler options for C++ source files and Release target")
-set(CMAKE_CXX_FLAGS_MINSIZEREL "-mwindows -DNDEBUG -Os" CACHE STRING "Compiler options for C++ source files and MinSizeRel target")
+set(CMAKE_CXX_FLAGS_RELEASE "-Wno-aggressive-loop-optimizations -DNDEBUG -O3" CACHE STRING "Compiler options for C++ source files and Release target")
+set(CMAKE_CXX_FLAGS_MINSIZEREL "-DNDEBUG -Os" CACHE STRING "Compiler options for C++ source files and MinSizeRel target")
 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Compiler options for C++ source files and RelWithDebInfo target")
 
 # Uncomment the next line and set the right value to override the default value (special compiling flags for RTEngine)
@@ -39,12 +39,12 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Compiler options for C
 
 set(CMAKE_C_FLAGS "-mwin32 -m64 -mthreads -msse2" CACHE STRING "Compiler options for C source files")
 set(CMAKE_C_FLAGS_DEBUG "-O0 -g2" CACHE STRING "Compiler options for C source files and Debug target")
-set(CMAKE_C_FLAGS_RELEASE "-mwindows -DNDEBUG -O2" CACHE STRING "Compiler options for C source files and Release target")
-set(CMAKE_C_FLAGS_MINSIZEREL "-mwindows -DNDEBUG -Os" CACHE STRING "Compiler options for C source files and MinSizeRel target")
+set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O2" CACHE STRING "Compiler options for C source files and Release target")
+set(CMAKE_C_FLAGS_MINSIZEREL "-DNDEBUG -Os" CACHE STRING "Compiler options for C source files and MinSizeRel target")
 set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Compiler options for C source files and RelWithDebInfo target")
 
 set(CMAKE_EXE_LINKER_FLAGS "-m64 -mthreads -static-libgcc" CACHE STRING "Linker options")
 set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-O0" CACHE STRING "Linkage options for the Debug target")
-set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-mwindows -s -O3" CACHE STRING "Linkage options for the Release target")
-set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "-mwindows -s -Os" CACHE STRING "Linkage options for the MinSizeRel target")
+set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s -O3" CACHE STRING "Linkage options for the Release target")
+set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "-s -Os" CACHE STRING "Linkage options for the MinSizeRel target")
 set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "-s -O2" CACHE STRING "Linkage options for the RelWithDebInfo target")

For rawtherapee.exe (non cli) the -mwindows flag is already set here

If you just need to run it for multiple files from a cmd prompt, you can use a loop:

for %f in (*.cr2) do (rawtherapee-cli.exe -w -o %~nf.jpg -c  %f)

More details can be found in the Microsoft docs:

https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/for.mspx?pf=true

@heckflosse Yes seems ok like that for rawtherapee_cli.exe
But a command windows opens when running rawtherapee.exe

It will become tricky to build a correct installation if we need also to generate the cli version without -mwindows and the gui version with -mwindows.

nevertheless uploading RawTherapee_dev_5.1-38_nomwindows_WinVista_64.zip at https://drive.google.com/open?id=0B2q9OrgyDEfPS2FpdDAtMVI1RG8

@gaaned92
Hmm, that would mean, this does not work. Maybe @Hombre knows…

Windows 10 x64
If you mean using “&” and “&&” - it doesn’t work too: alll commands run simultaneously.

Unfortunately,
for %f in (*.cr2) do ("c:\Program Files\RawTherapee\5.1\rawtherapee-cli.exe" -w -o %~nf.jpg -c %f)
runs all instances of rawtherapee-cli.exe in parallel.

1 Like

Tried this version - rawtherapee-cli.exe works as expected.
Gui version runs with additional console window.

1 Like

Sorry for the late reply, the notification email landed in the ‘spam’ directory…

I probably missed that point and forgot to remove temporary modifications before committing. The line pointed out by @heckflosse ( here ) have to be commented out, and the "-mwindows’ switch removed from your build options file, as done in @heckflosse’s patch. That way the cli version won’t run in its own process but the gui version will.

Btw, if you intend to run RT-cli by specifying one file at once only (you can use wildcards if you want), then you can reduce the start time by using the ‘-q’ switch. In this case, some dependencies like color profile or HaldCLUT profiles will only be listed/loaded if used.

3 Likes

Yes, thanks, I use it.

@Hombre Could you bring me some clarification
1- It seems to me that the line 182 of rtgui/CMakeLists.txt is already commented out in the dev branch. So no need for a modification.
2- If I remove the -mwindows switch, cli version works as expected by @Gnitry, but the gui version opens an additional console windows, that is not the expected behaviour.

So I think the goal is to build at the same time a cli and gui version that have each the expected behaviour. Is it possible?

Thank you

@gaaned92 I just pushed a fix. Works fine here.

@gaaned92 Sorry, that’s the problem is replying at 1:20AM… I meant to uncomment it, i.e. make it active again. But @heckflosse has committed the fix.

@heckflosse @Hombre
I tested the fix for gui , cli and debug version. works fine.

@Gnitry you will find fixed RawTherapee_dev_5.1-53-ga48572d5_WinVista_64.zip at
https://drive.google.com/open?id=0B2q9OrgyDEfPS2FpdDAtMVI1RG8

Yes, it works fine.
I found that in this version additional console doesn’t appear even if I don’t use “-w” parameter.
But, as for me, I don’t need this additional window :slight_smile:

Thank you.

That’s correct behaviour now. The -w parameter suppresses the additional console window.
But as we now have the rawtherapee-cli.exe we don’t need this parameter anymore.

There are two cases where the console window should open and where it makes no sense to suppress it:

  1. when you start rt in verbose mode
  2. when you pass a parameter (e.g. -h) to the rawtherapee.exe