Script for Automatic Multiple instances of cr2hdr (Windows)

Started by engardeknave, September 26, 2013, 12:36:15 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


perfect, thanks.
it works now as expected. :)


Now it always puts the dualisos, compressed dngs, and regular cr2s in a folder. See the options.



How to do this on a mac??

Maybe run a windows application and run the script from there?


I don't have a Mac. I'm sure there's a Mac solution somewhere here, though.


In the script, it seems that the command line wants an argument for the actual directory where the .cr2 files are. I use a command line of either
VbsScript S:\MyCr2Dir   or
VbsScript .

Otherwise, the script prompts for a subdirectory.

Would it be ok to have a line in the script hear the top:

and then comment out lines that invoke the Open dialog?

' if Wscript.Arguments.Count>0 then
'   inputfolder=Wscript.Arguments(0) 'command line
' else
'   inputfolder=getfolder("Select the folder containing the dual ISO .CR2 files.")
'  if inputfolder="" then WScript.Quit
' end if


Just checking ... in the .vbs script, is the version with the filename cr2hdr-cmd.exe a modified version of the normal cr2hdr.exe, except with additional debugging options?

Also, I'm confused on what the following line does:

It doesn't seem to make any difference whether it is true or false.
The original .cr2's are still deleted, regardless, from the original directory with the cr2hdr.exe and .cr2 files:

That was unexpected.

The .cr2 files do seem to be preserved in the created subdirectories:
"Regular CR2s"
"Dual ISO CR2s"

So I guess that is fine.


Quote from: RenatoPhoto on September 26, 2013, 01:58:14 PM
Ok, I am vbs illiterate.

Is there a way to run the script at lower priority so it doesn't reduce the responsiveness of the foreground window?

such as a change to statement:
    WshShell.Run line,windowtype,false

From the command line, you can use:
start /belownormal cr2hdr .....

Also, the script seems to remove Rating Stars and Label Colors that were in the .xml sidecar files. They were put there with Adobe Bride. I used Stars
and Labels to keep track of which files were in what category:
* 6d or 5d2
* Dual-ISO or non-Dual-ISO
* _MG or _UAL or _0

Is that "as expected"?



QuoteWould it be ok to have a line in the script hear the top

You could just do that and answer your own question. Nothing's going to explode if you edit it. The whole advantage of using this is that you can customize it. Anyway, there's a line where you can put your own input directory now.

Quoteis the version with the filename cr2hdr-cmd.exe a modified version of the normal cr2hdr.exe, except with additional debugging options

It's an old version.


This deleted the uncompressed dng, but it's no longer relevant.

QuoteIs there a way to run the script at lower priority

Reduce maxprocs.

QuoteAlso, the script seems to remove Rating Stars and Label Colors that were in the .xml sidecar files.

It doesn't move any .xml files. Run script first then edit.



Thanks. Looks good.

Several minor revisions to consider:
dualisocr2dir="Dual ISO CR2s"
regularcr2dir="Regular CR2s"
dngoutputdir="Dual ISO DNG"

* Consider having dashes or underscores or CamelCase, instead of spaces in filenames
* Consider having plural DNG for consistency with plural CR2s

Here's what I use, with verbose hints to myself on what to do with them next:

* Consider having the variable for inputfolder up at the top with the variable for cr2hdrpath. I'd think the preferred default would be:

Also, would it be possible to have an option for the script to proceed to process the "Regular CR2s" that were not Dual-ISO with DngConverter? Could that be the default?

FWIW: With my 2600k that has 4 cores and multi-threading, use of
instead of 8 procs
still pretty much pegs the Windows TaskManager cpu monitor, and makes the computer unresponsive.

I've been launching a Cmd window, setting its priority to BelowNormal, and then launching the .vbs script from that. That keeps the foreground window responsive instead of very sluggish.  Am I doing something wrong?



Only tried on a few files but it should now correct green tint. Set exiftoolpath and correcttint in the options.


I really like your script.
But the newer Version doesnt work for me.

I have put the Script, the cr2hdr.exe and the exiftool.exe into the folder C:\cr2hdr\.
And change of course:

But ifi run the script, it says "No DNG files created. Check script options and log.".

Started: 30.03.2014 19:11:48

Input folder is C:\Users\Pacman\Pictures\test

Searching for .CR2 files
Queued cmd.exe /c ""C:\cr2hdr\cr2hdr.exe" --compress "DUAL8298.CR2" > DUAL8298.CR2.log "
Queued C:\cr2hdr\exiftool.exe DUAL8298.dng -asshotneutral="0.473635 1.05 0.624" -overwrite_original

Converting Dual ISO .CR2 files
Executing: cmd.exe /c ""C:\cr2hdr\cr2hdr.exe" --compress "DUAL8298.CR2" > DUAL8298.CR2.log "

Running exiftool
No DNG files created. Check script options and log.

It seems, that the script ignore the Inputfolder.

Do you have any ideas?


P.S.: And one little other wish, i have.
Can you add your script a Versions Number. So i can see, if you change anyting.
Thanks a lot ;op


QuoteMake sure all paths end with a "\", ie. "C:\cr2hdr\"

Try adding a slash to the end of all paths. It should work fine with long paths too.

I also just updated it to remove the tint adjustment. (It won't work with most cameras, and is incompatible with the latest cr2hdr.) Also a couple of other bugs that would prevent it from working for anyone but me probably.

I'll just add a date to the top of the script.


Thanks for the quick answer.

The date at the top of the script is great  :D.

But the Script doesnt work   :(
It finds my CR2 Files, but doesnt do anything.
The DUAL8298.CR2.log looks like this.

cr2hdr: a post processing tool for Dual ISO images

Last update: d0ac769 on 2014-01-23 10:13:39 UTC by alex:
cr2hdr: experimental white level routine with two separate levels ...

Active options:
--amaze-edge    : use a temporary demosaic step (AMaZE) followed by edge-directed interpolation (default)
--cs2x2         : apply 2x2 chroma smoothing in noisy and aliased areas (default)
--compress      : Lossless DNG compression

Input file      : DUAL8298.CR2
Camera          : Canon EOS 5D Mark III
Full size       : 0 x 0
Active area     : 0 x 0

But i didnt have a 5D Mark III and the files size is not correct to.
If i put my test file into a other paths (C:\Test\) it doesnt work too.
The only way to make it work, is copy the cr2 into my working paths "C:\cr2hdr\".

i added of course a slash to the end of all paths.

Do you have any other ideas?

Thanks a lot


Did you change the cr2hdr path in the script? Please check all the script options and make sure everything is set correctly. Also read all the directions above and comments in the script by all the settings. If you did all that, post your config (the top settings of the script).


Thanks for your help.
i dont see, what iam doing wrong.

Here is my config part:
'last update: 3/30/2014

cr2hdrpath="C:\cr2hdr\" 'ends with a slash \

exiftoolpath="C:\cr2hdr\" 'ends with a slash \
inputfolder="C:\pictures\" 'dialog will start at this folder if set (ends with a slash \)

dualisocr2dir="Dual ISO CR2"
regularcr2dir="Regular CR2"
dngoutputdir="Dual ISO DNG"

organize=true 'sort files into subdirectories when done processing

maxprocs=4 'Number of simultaneous processes
'0 Hide the window and activate another window.
'1 Activate and display the window. (restore size and position) Specify this flag when displaying a window for the first time.
'2 Activate & minimize.
'3 Activate & maximize.
'4 Restore. The active window remains active.
'5 Activate & Restore.
'6 Minimize & activate the next top-level window in the Z order.
'7 Minimize. The active window remains active.

This part of the log Files is confusing me.
Executing: "C:\cr2hdr\cr2hdr.exe" --compress "DUAL8298.CR2"
Why i dont see my Paths there?


Started: 4/2/2014 2:35:34 AM

Input folder is C:\pictures

Searching for .CR2 files
Queued "C:\cr2hdr\cr2hdr.exe" --compress "IMG_7361.CR2"

Converting Dual ISO .CR2 files
Executing: "C:\cr2hdr\cr2hdr.exe" --compress "IMG_7361.CR2"

Moving Dual ISO .CR2 files
Created "C:\pictures\Dual ISO CR2"
Moving "C:\pictures\IMG_7361.CR2" to "C:\pictures\Dual ISO CR2\IMG_7361.CR2"

Moving any regular .CR2 files

Moving Dual ISO .DNG files
Created "C:\pictures\Dual ISO DNG"
Moving "C:\pictures\IMG_7361.DNG" to "C:\pictures\Dual ISO DNG\IMG_7361.DNG"

Moving log files

Processed 1 file(s). Converted 1 Dual ISO(s). Runtime: 19.61 seconds.

Created "C:\pictures\logs"

Just tried those folders and it works for me. It doesn't show the path at that point. Check to make sure that file is valid. Run cr2hdr on it from the command prompt manually.

There's also a couple other solutions to running multiple cr2hdrs in this section if you haven't tried them.


I have tested and i dont understand it  :P.

In the folder C:\cr2hdr\ i have the "cr2hdr.exe" "dcraw.exe" "exiftool.exe" und your vbs script.
In the folder C:\Test\ i put a dual iso test image.

if i run the script in the folder C:\cr2hdr\ it doesnt work.

If i put the "cr2hdr.exe" "dcraw.exe" "exiftool.exe" files in the folder C:\Test\ too.
It works like a charm if i start the script in the folder C:\Test\.  ???


The script works by running cr2hdr with the current directory set to the folder containing the images. This is because I couldn't cr2hdr to work correctly with paths and file names. The current directory is set at the line wshshell.currentdirectory=inputfolder. You can check if the current directory is properly set (to c:\test) with msgbox wshshell.currentdirectory. You also might try replacing the line wshshell.currentdirectory=inputfolder with wshshell.currentdirectory="c:\test".


Is there a way to change multiple_cr2hdr.vbs so that I can move the folder around and it will still work?  By that I think I mean have all the extra files in the same directory as multiple_cr2hdr.vbs, and just drop CR2 files in the same directory and run it.

I think this requires setting the paths relative to multiple_cr2hdr.vbs script...


At the top:


And maybe comment out inputfolder=getfolder(...


Thanks so much!

For anyone else interested, you can change all of these, if desired:


Works great for me.  I just drop my Raw files in the same folder as the script and run  the script.  done!



I'm also (especially) interested in having it work for .dng files as made from ML RAW dual-ISO video.  It seems to only work for my CR2 stills...