Created
October 19, 2022 17:35
-
-
Save weaming/c9be9be7c7ccf9de07bad44c890b10c9 to your computer and use it in GitHub Desktop.
Revisions
-
weaming renamed this gist
Oct 19, 2022 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
weaming created this gist
Oct 19, 2022 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ #!/usr/bin/env python3 # For M1: #!/usr/bin/arch -x86_64 /Library/Frameworks/Python.framework/Versions/3.10/bin/python3 """ Batch convert DNG to TIFF. Install dependencies: python3 -m pip install numpy cython imageio For M1: 1. download & install "macOS 64-bit universal2 installer" via https://www.python.org/downloads/release/python-3108/ 2. use the universal2 version python to install dependencies: /usr/bin/arch -x86_64 /Library/Frameworks/Python.framework/Versions/3.10/bin/python3 -m pip install numpy cython imageio /usr/bin/arch -x86_64 /Library/Frameworks/Python.framework/Versions/3.10/bin/python3 -m pip install rawpy """ import os import rawpy import imageio for infile in os.listdir("./"): if infile[-3:] == "DNG": outfile = infile[:-3] + "tiff" raw = rawpy.imread(infile) print(infile, '==>', outfile) # https://letmaik.github.io/rawpy/api/rawpy.Params.html#rawpy.Params rgb = raw.postprocess( use_camera_wb=True, half_size=False, no_auto_bright=False, output_bps=16, output_color=rawpy.ColorSpace.ProPhoto, ) imageio.imsave(outfile, rgb)