[Solved] Change of queue output directory not taken fully into account if no %f

First of all, thank you very much for this wonderful piece of software !
(I don’t want to sound like I’m complaining :slight_smile: )

I found an unexpected behavior when changing the output directory in the Queue tab.
I use a folder structure like this :

photos folder/
photos folder/photo_1.jpg
photos folder/raw/
photos folder/raw/photo_1.arw (Sony raw file)

Before when writing the developed pictures, I used to create a “converted” subfolder in the raw directory and then move the photos by hand. In this case the output directory was :

Then checking the tooltip on the output directory I realized that I could ask Rawtherapee to automatically put my output JPG directly in the correct directory one level higher with the %p2 variable.
The problem was that I did not pay attention and just used %p2 without %f.
In this case no error message is displayed and pictures end up in %p2/converted folder.
Now I changed to %p2/%f and pictures end up in the correct folder without the added “converted”.

I hope I’m clear enough.


  1. Copy a raw file to /tmp/photos/raw/pippi.arw
  2. Set the queue template to %p2/%f and the file gets saved to /tmp/photos/pippi.jpg, all good.
  3. Set it to %p2 only, without the %f, and the file gets saved to /tmp/photos/photos.jpg. Likewise, if you set it to %p3 only, you get /tmp/tmp.jpg

Though it may seem odd, it is consistent. The filename used while exporting does not need to resemble the filename of the input image.

Dear Morgan,

the behavior you explain is indeed odd, but is not exactly the issue I faced.

I took some screenshots to be more clear :

  1. initial setup similar to your case but with 2 raw files

  2. first export in %p1/convert/%f

  3. expected result in the output directory

  4. back in rawtherapee change the output to %p2 only

  5. the surprising result is a directory called “convert” in the %p2 path containing the JPG files

Yet another OOB access:

diff --git a/rtgui/batchqueue.cc b/rtgui/batchqueue.cc
index 9792522c7..2aa94c389 100644
--- a/rtgui/batchqueue.cc
+++ b/rtgui/batchqueue.cc
@@ -860,9 +860,9 @@ Glib::ustring BatchQueue::calcAutoFileNameBase (const Glib::ustring& origFileNam
     Glib::ustring path = "";
     if (options.saveUsePathTemplate) {
-        int ix = 0;
+        unsigned int ix = 0;
-        while (options.savePathTemplate[ix] != 0) {
+        while (ix < options.savePathTemplate.size()) {
             if (options.savePathTemplate[ix] == '%') {


1 Like

@floessie will you commit this fix, or should I?

You can. I’m busy ATM. Thanks!

I can’t reproduce @Pietro_Dolcini’s issue where /tmp/photos/convert/ is magically created when using template %p2, so I noticed no difference with the patch on my end.
Patch committed to dev. @Pietro_Dolcini if you compile yourself, then you can help verify that it’s fixed.

The commit is 5.5-283-g977af213b, branch dev.

Thanks !
Now compiling, I’ll let you know the result this evening.


just finished testing.

Now with the previous sequence I get as a result two pictures calles photos.jpg and photos-1.jpg.

In Rawtherapy interface the place where I should write %p2/%f is called “output directory” not “output file names” or maybe simply “output name” which makes it a little surprising that changes the name of the files. Maybe changing the name would avoid other users to make the same mistake as me.

Thank you very much to take the time to make the correction.

Agreed, and there were some other issues.
Fixed in 5.5-286-g5bddcb45d.

Thank you for reporting.

1 Like