Hello everyone !
It’s only recently that I discovered HDRMerge and I love :
the batch mode
normal size 16bit HDR files
the GUI to handle ghosts.
But I use Canon cameras with CR3 files. That is why I made myself a little python script (nothing fancy, I’m a total beginner in python) to handle things with some automation.
It works this way :
I put the CR3 files paths that I want to exploit in a txt file (easy for to grab them with doublecommander).
the txt file is red to grab the CR3 files and dnglab convert them files to DNG
DNG files are fed to hdrmerge batchmode. HdrMerge Parameters can easily be changed in the script.
at the end of the script, there is the possibility to delete the DNG files (not the HDR ones of course). dnglab_hdrmerge.py (2.8 KB)
I made a new version of my script to handle easily the creation of HDR files with HDRmerge from Canon CR3 files.
Now, at the beginning of the script you can chosse between two options :
F option (File) : reading from a txt file that contains the CR3 files full paths that you want to work with
T option (Time) :
- a) the script detects the directories that are new or that have seen some activities (files modified or new ones created inside of it)
- b) after choosing the directory you want to work with, the script will detect only the new CR3 files that are inside and feed them to DNGlab and then HDRMerge in batch mode.
Parameters that have to be set in the script :
for the FILE mode : link to the txt file that gives the CR3 file paths.
for the TIME mode : path to your whole photo directory and the time interval in minutes to filter in “new files”.
HDRMerge parameters can also be modified : gap, bits per sample and previewsize.
Again this is beginner python code, it’s not beautiffuly written but it works What I love is the great simplicity of DNGLab and the magic of the HDRMerge batch mode. I am now only using these tools instead of the HDR tool in Darktable. The small file sizes are great. dnglab_hdrmerge_v0.4.py (8.4 KB)
HDRMerge will correct small misalignments by translation. So, if your camera allows it, you can take the shots with bracketing in burst mode. I have successfully done this just holding the camera with my hands, but using a tripod is highly recommended to obtain the best results.
(GitHub - jcelaya/hdrmerge: HDR exposure merging)
Yes, HDRMerge has the option to correct misalignments. IIRC corrections in translations can be done but it does not work in rotation. I included the option in the script : you can choose to activate auto-alignement or not.
I am showing total ignorance here. I want to test out this script. I presume I have to have both HDRMerge and dnglab installed. I believe I have done that but when I run dnglab I get the flash of a very quick screen and then nothing.
where do I place the script you wrote? I am on a windows computer.
I do not know windows very well regarding Python. I hope I can help, here’s what I think.
Do you you have python installed on your pc ? You need to in order to be able to execute the script. The script could be converted to an .exe but in this case you wouldn’t be able to modify the code, so I prefer to stay with *.py script files.
Once Python installed you should be able to execute the script in the command line interface :
python C:\path\to\dnglab_hdrmerge_0.4.py
Before that, you have to make some (really easy) tweaks in the code to adapt it to windows : replace ‘dnglab’ with ‘C:\path\to\dnglab.exe’ and ‘hdrmerge’ with ‘C:\path\to\hdrmerge.exe’
But when I type either Y or N and click on enter it just all disappears. I just don’t seem to know what I am doing. I hope someone can guide a dunderhead of a windows user in how to run this script on Windows 11.
I was unsure where to replace replace ‘dnglab’ with ‘C:\path\to\dnglab.exe’ and ‘hdrmerge’ with ‘C:\path\to\hdrmerge.exe’. This is what I tried, but it didn’t help.
In Python, and most languages, \ is often used in combination with letters to create special characters. For example, \n would mean a new-line character, \t would mean Tab.
So, in Python, if we have a variable called path, the following would set it: path = 'C:\\path\\to\\hdrmerge.exe'
or path = "C:\\path\\to\\hdrmerge.exe"
So, you either add the executables to your PATH variable, and then you don’t need to change anything, or you have to modify for example this line:
Setting PATH may be more convenient: any program whose directory is on the search path can be invoked without specifying its full path. That’s how it’s also done on Linux.
I am making some progress. Sorry for the struggle on my part here. I have downloaded your v0.4.py script and modified the paths to dnglab and hdrmerge. Now when I start the script I get further into it but am struggling with picking the directory to look for new CR3 files. I have used the darktable copy feature to copy three CR3 files to a folder called HDR merge which is located in the pictures folder on my X drive. I presume I have typed this wrong. Your patience and help would be appreciated.
Use single forward slash in the path, not double. So X:/some/path, not X://some//path. The doubling is only needed for backslash, to indicate you are not using it to create special characters (newline, tab etc.). Forward slash has no such special behaviour, and even for backslash, the special behaviour applies to source code, not keyboard input.
You can read more here, if you want, but it’s not needed, strictly speaking:
I’d also avoid spaces in the path, they can be problematic. I don’t know if that is the case for this script, but better safe than sorry. I usually use underscores instead.
No problem Terry, happy to help. If you want to use the “time” function, you can just write on line 29 :
source_file:str = “X:/Pictures (X)/”
This folder will be scanned and then you’ll have the option to choose ‘X:/Pictures (X)/HDR merging’ in the “LISTE” (sorry, it’s not fully translated to english) because you recently made some modifications to it.
You could also use the File function and have something like this. On line 26 :
From my point of view, “File mode” is useful when you want to deal with old files from previous photo sessions, whereas the “time mode” is easier when you just transfered your new photos on your harddrive. The great stuff in all of this is the magic of the hdrmerge batch mode, with its detection of group of photos.
PS : like Kofa said, it is advised to avoid whitespaces in the directory structures. My code is some beginner level stuff, I didn’t make it proof to every possible situation, only the usual.
I will get back to trying your script soon. Thanks for the reply. I lost internet yesterday so I didn’t receive anyone’s replies. Instead I tried using Hugin for the first time for HDR merging. It did a very reasonable job with hand held images. I see it also does focus stacking. I want to explore Hugin and HDR merge to find the best HDR merge program for the rare occasion I need it. The Canon software did a disappointing job. I do a lot of hand held bracketed shots and occasionally HDR merge can help. But with modern sensors this has become less of an issue as the cameras capture a wider dynamic range compared to my 2005 cameras.