import os, sys try: raw = sys.argv[1] num = int(sys.argv[2]) except: print print "Usage: python dngfloat_hdr.py abc.dng 5" print " => abc.dng must be a floating-point DNG with white level set to 65535" print " => 5 is the number of LDR exposures (spaced at 2 EV) to be extracted from our DNG and enfused" print raise SystemExit def run(cmd): print cmd os.system(cmd) try: os.mkdir("tmp") except: print "warning: could not create tmp dir" run("rm tmp/*") for i in range(num-1,-1,-1): cmd = "exiftool -overwrite_original -WhiteLevel=%d %s" % (65536*2 / 2**(i*2), raw) run(cmd) cmd = "dng_validate.exe -16 -tif tmp/%d.tif %s" % (i, raw) run(cmd) run("enfuse tmp/*.tif")