Batch convert RAW (NEFs) images to Tiff (16 bit) AND rotate them 180°

Hello everyone,

I am doing my best to learn how to batch convert a bunch of RAWs images (Nikon D850) to Tiff (16 bit integer) with RawTherapee (on Windows 10). Thanks to RawPedia [1]…
My real final goal is to focus-stacking these Tiff with Zerene stacker software…

To batch convert my RAWs images I type in the CMD (prompt command of Windows 10):
rawtherapee-cli.exe -o D:\prove -b16 -t -Y -c D:\prove\*.NEF
#where the output (-o) is tiff integer 16 bit for every rgb channel (-b16 -t)
#I overwrite any identical TIFFs IF already exists (-Y) in the folder “prove”

My real question is:
Is it possible to also rotate the RAW (NEFs) images to180° while batch converting them to Tiffs?
I take my macro pictures on a tripod and all of them are upside-down…

EDIT:
After a bit of thinking, I suppose the batch rotation might be better off with ExifTool or other similar exif tools…
Needless to say, I might rotate all my RAWs images with the RawTherapee GUIs and spare me all the hassle…

[1] https://rawpedia.rawtherapee.com/Command-Line_Options

Using img, the rawproc command line program:

$ img "*.NEF:rawdata=crop" subtract:camera whitebalance:camera demosaic:ahd colorspace:camera,assign rotate:180 "tiffs/*.tiff"

assuming NEFs are in the cwd and there’s a tiff/ subdirectory. The quotes around the file input and output are to keep the shell from futzing with the wildcard specification.

Hello @ggbutcher

Thanks a lot for your help! :slight_smile:

Tried your command and it kind of works…
More precisey, I end up with 2 problems:

  • all my new tiffs are pitch-black. Tried many softwares to visualize them properly to no avail :slight_smile:
  • BTW, is it possible to save my RAWs image to 16 bit integer? I may be wrong, but it looks like they are saved as 8 bit integer right now…

White balancing is 2865 kelvins (manually set…)

Here is one tiff (Nikon D700):

Oops, forgot a tool:

$ img "*.NEF:rawdata=crop" subtract:camera whitebalance:camera demosaic:ahd blackwhitepoint:rgb,data colorspace:camera,assign rotate:180 "tiffs/*.tiff"

blackwhitepoint:rgb,data, scales the data to fill the 0.0 - 1.0 range. This should put some visibility in them…

Edit: Oh, with this string, the TIFFs will still be in camera space. If you want them in something else like sRGB, you can either

  1. set output.tiff.cms.profile=srgb, you can do this in rawproc and img will read it, or;
  2. put colorspace:srgb,convert in the img chain just before the ouput filespec.

Hello @ggbutcher

How about getting a 16 bit integer tiff?
Right now it looks 8 bit (unless I am wrong…)

In rawproc, the Properties dialog, set output.tiff.parameters to channelformat=float

I’m doing this too quickly, I specified ‘jpeg’ for the various properties. Corrected now, should be ‘tiif’, e.g. output.tiff.parameters

One possibility starts by creating custom processing profiles:

  • open one image (any image)
  • apply neutral processing profile
  • rotate left or right the image (do only this change) in order to rotate the image upside down
  • save the processing profile and name it e.g. «rotate180.pp3»
  • [optional] edit the pp3 with a text editor and leave only this lines of text:

[Coarse Transformation]
Rotate=180

Then you just add one option to your command:

rawtherapee-cli.exe -o D:\prove -b16 -t -Y -p rotate180.pp3 -c D:\prove\*.NEF

According to RawPedia:

-p <file.pp3>
Specify processing profile to be used for all conversions.
You can specify as many sets of “-p <file.pp3>” options as you like, each will be built on top of the previous one, as explained below.

You add the processing done in the rotate180.pp3 profile. As you only rotated the image, that’s the only thing added to the processing from the command-line

Hope it helps

to rotate 180 in RT, I use coarse rotation 180. I click 2 times on icon and its saved in profile or partial profile.

So why it should be impossible to rotate 180° in batch.

Hello @ggbutcher @XavAL

Thanks a lot indeed!

1 Like

Hello @ggbutcher

Just out of curiosity…
In order to produce a Tiff (16 bit every rgb channel from my NEFs) Is there a difference between these 2 commands as regards the rawproc img.exe tool?

img.exe “.NEF:rawdata=crop" subtract:camera whitebalance:camera demosaic:ahd blackwhitepoint:rgb,data colorspace:camera,assign rotate:180 "tiffs/.tiff:format=16int”

Versus:

img.exe “.NEF:rawdata=crop" subtract:camera whitebalance:camera demosaic:ahd blackwhitepoint:rgb,data colorspace:camera,assign rotate:180 "tiffs/.tiff:format=float”

1 Like

First, the parameter is ‘channelformat’ in both cases. Also, the values are ‘16bit’ and ‘float’. And, the asterisk wildcard is missing, but I find some of these characters can be stripped by the site formatter.

The first one saves 16-bit TIFF, the other a float TIFF. You want 16-bit and I gave you the float parameter instead. My bad…

Hello @ggbutcher

Now it works:
img.exe “*.NEF:rawdata=crop” subtract:camera whitebalance:camera demosaic:ahd blackwhitepoint:rgb,data colorspace:camera,assign rotate:180 “tiffs/*.tiff:channelformat=16bit”
#BTW, you have first to escape the * with \ to make it appear in this page (just discovered now…) :slight_smile:

Actually, for me these Tiffs (16 bit integer for channel) are most likely a bit of an overkill for my focus stacking purposes with Zerene stacker.
So far I always used the JPEGs, not-compressed, produced directly from my D850 (even though I always knew the TIFFs were a better starting-point for the end-result…) :slight_smile:

1 Like

@Silvio_Grosso

I forgot to mention that you also have an auto-rotation option in Zerene that may come in handy for you, if you wish: Preferences>Input/Output>Preprocessing>Image Pre-rotation: 180 degrees

Just in case is a simpler method to you.

Silvio, here is my very simple way…

For my stacking process I don’t use the shell batch but the RT UI.

  • I apply all changes to one of the stacking raw photos including the rotation
  • I copy this profile to all raws in that stacking series (via RT file browser)
  • I put all raws into the batch queue and chose 16 bit TIFF as output
  • I start the queue and use all developed TIFFs in Picolay, the stacking software I use

Hello @mozzihh, @XavAL

Thanks a lot.

I have tried Picolay and on the whole it works well.
In the past, I have also reported some bugs to its German creator. The program was crashing with big jpeg files produced by my Nikon D850. He quickly replied to my email and he fixed the crash in the following release :slight_smile:

Did you get good results with Picolay?
Today, I have installed the newest version on Windows 10 and I have tested it once again with some insects stackings.
The results were not entirely good although I have tried to apply variuos settings (2x, test 4 filters settings etc etc).
With Zerene stacker the final result is usually better than Picolay, IMHO.

Well, I’m afraid that my opinion is not unbiased, as I’m a paid user of Zerene… :slight_smile:

Anyway, although Picolay is «good», Zerene is currently the «best» in my opinion regarding the stack quality.

Hello @XavAL

Anyway, although Picolay is «good», Zerene is currently the «best» in my opinion regarding the stack quality.

In my view, what is interesting about Zerene is that it also works natively on Linux (with Picolay you need Wine on Linux) and, most of all, you can upgrade its next versions without paying anything further (it is all legit).

1 Like