Last active
September 11, 2020 17:09
-
-
Save tokejepsen/91d9ecdd511dc21c6404a6a5b99f0dfd to your computer and use it in GitHub Desktop.
Luminance Batch HDR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
python C:\Users\admin\Desktop\luminance_batch_hdr.py "C:\Program Files\Luminance HDR\v.2.6.0\luminance-hdr-cli.exe" C:\Users\admin\Desktop\sorted 13 | |
""" | |
import os | |
import sys | |
import subprocess | |
def is_whole(n): | |
return n % 1 == 0 | |
def main(executable_path, files_path, brackets): | |
bracketed_files = [] | |
bracket = [] | |
for count, filename in enumerate(sorted(os.listdir(files_path)), start=1): | |
if is_whole(count / int(brackets)): | |
bracketed_files.append(bracket) | |
bracket = [] | |
else: | |
bracket.append(filename) | |
for bracket in bracketed_files: | |
name = "{}-{}.exr".format( | |
os.path.splitext(bracket[0])[0], | |
os.path.splitext(bracket[-1])[0] | |
) | |
cmd = [executable_path, "--save", name, *bracket] | |
subprocess.call(cmd, cwd=files_path) | |
if __name__ == "__main__": | |
main(*sys.argv[1:]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment