-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathraw-exr-converter.py
49 lines (39 loc) · 1.32 KB
/
raw-exr-converter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import subprocess
import sys
import time
from pathlib import Path
from lxmimgproc.browse import get_dir_content
THISDIR = Path(__file__).parent
CLISDIR = THISDIR.parent / "clis"
CLIPATH = CLISDIR / "raw-exr-converter.py"
RAW_SRC_DIR = Path(r"G:\personal\photo\workspace\dcim\2024\2024_06_20_mshootsweat")
EXIFTOOL_PATH = Path(r"F:\softwares\apps\exiftool\build\12.70\exiftool.exe")
def main():
src_paths = get_dir_content(
RAW_SRC_DIR,
file_extensions=[".dng"],
)
print(f"processing {len(src_paths)} files")
for index, src_path in enumerate(src_paths):
print(f"{index+1}/{len(src_paths)} 💬 starting '{src_path.name}' ...")
dst_path = src_path.with_stem("{input_filestem}.{preset}.{colorspace}")
dst_path = dst_path.with_suffix(".exr")
command = [
sys.executable,
str(CLIPATH),
str(dst_path),
str(src_path),
"--colorspace",
"@native",
"--preset",
"normal",
# "--overwrite-existing",
"--exiftool",
str(EXIFTOOL_PATH),
]
stime = time.time()
subprocess.run(command)
etime = time.time()
print(f"{index+1}/{len(src_paths)} ✅ completed in {etime - stime:.2f}s ...")
if __name__ == "__main__":
main()