X-Git-Url: http://users.mur.at/ms/git/gitweb/?p=OpenColorIO-Configs.git;a=blobdiff_plain;f=aces_1.0.0%2Fpython%2Faces_ocio%2Fgenerate_lut.py;h=959e8a4f8e45349c18a24c0a111111db6cc0e4a6;hp=e0d4dfaa367ef345d8a7195f4035c41b985e7b7b;hb=cad9d48a0f1067769435904348e9fffeffd25eb9;hpb=6eac5f132b3888eee16a8306d91b9405346f3ac2 diff --git a/aces_1.0.0/python/aces_ocio/generate_lut.py b/aces_1.0.0/python/aces_ocio/generate_lut.py old mode 100644 new mode 100755 index e0d4dfa..959e8a4 --- a/aces_1.0.0/python/aces_ocio/generate_lut.py +++ b/aces_1.0.0/python/aces_ocio/generate_lut.py @@ -6,6 +6,8 @@ Defines objects to generate various kind of 1d, 2d and 3d LUTs in various file formats. """ +from __future__ import division + import array import os import sys @@ -36,8 +38,8 @@ __all__ = ['generate_1d_LUT_image', def generate_1d_LUT_image(ramp_1d_path, resolution=1024, - min_value=0.0, - max_value=1.0): + min_value=0, + max_value=1): """ Object description. @@ -52,13 +54,8 @@ def generate_1d_LUT_image(ramp_1d_path, Return value description. """ - # print("Generate 1d LUT image - %s" % ramp1dPath) - - # open image - format = os.path.splitext(ramp_1d_path)[1] ramp = oiio.ImageOutput.create(ramp_1d_path) - # set image specs spec = oiio.ImageSpec() spec.set_format(oiio.FLOAT) # spec.format.basetype = oiio.FLOAT @@ -68,8 +65,8 @@ def generate_1d_LUT_image(ramp_1d_path, ramp.open(ramp_1d_path, spec, oiio.Create) - data = array.array("f", - "\0" * spec.width * spec.height * spec.nchannels * 4) + data = array.array('f', + '\0' * spec.width * spec.height * spec.nchannels * 4) for i in range(resolution): value = float(i) / (resolution - 1) * ( max_value - min_value) + min_value @@ -81,7 +78,13 @@ def generate_1d_LUT_image(ramp_1d_path, ramp.close() -def write_SPI_1d(filename, from_min, from_max, data, entries, channels): +def write_SPI_1d(filename, + from_min, + from_max, + data, + entries, + channels, + components=3): """ Object description. @@ -99,25 +102,235 @@ def write_SPI_1d(filename, from_min, from_max, data, entries, channels): Return value description. """ - f = file(filename, 'w') - f.write("Version 1\n") - f.write("From %f %f\n" % (from_min, from_max)) - f.write("Length %d\n" % entries) - f.write("Components %d\n" % (min(3, channels))) - f.write("{\n") - for i in range(0, entries): - entry = "" - for j in range(0, min(3, channels)): - entry = "%s %s" % (entry, data[i * channels + j]) - f.write(" %s\n" % entry) - f.write("}\n") - f.close() + # May want to use fewer components than there are channels in the data + # Most commonly used for single channel LUTs + components = min(3, components, channels) + + with open(filename, 'w') as fp: + fp.write('Version 1\n') + fp.write('From %f %f\n' % (from_min, from_max)) + fp.write('Length %d\n' % entries) + fp.write('Components %d\n' % components) + fp.write('{\n') + for i in range(0, entries): + entry = '' + for j in range(0, components): + entry = '%s %s' % (entry, data[i * channels + j]) + fp.write(' %s\n' % entry) + fp.write('}\n') + + +def write_CSP_1d(filename, + from_min, + from_max, + data, + entries, + channels, + components=3): + """ + Object description. + + Parameters + ---------- + parameter : type + Parameter description. + + Returns + ------- + type + Return value description. + """ + + # May want to use fewer components than there are channels in the data + # Most commonly used for single channel LUTs + components = min(3, components, channels) + + with open(filename, 'w') as fp: + fp.write('CSPLUTV100\n') + fp.write('1D\n') + fp.write('\n') + fp.write('BEGIN METADATA\n') + fp.write('END METADATA\n') + + fp.write('\n') + + fp.write('2\n') + fp.write('%f %f\n' % (from_min, from_max)) + fp.write('0.0 1.0\n') + fp.write('2\n') + fp.write('%f %f\n' % (from_min, from_max)) + fp.write('0.0 1.0\n') + fp.write('2\n') + fp.write('%f %f\n' % (from_min, from_max)) + fp.write('0.0 1.0\n') + + fp.write('\n') + + fp.write('%d\n' % entries) + if components == 1: + for i in range(0, entries): + entry = '' + for j in range(3): + entry = '%s %s' % (entry, data[i * channels]) + fp.write('%s\n' % entry) + else: + for i in range(entries): + entry = '' + for j in range(components): + entry = '%s %s' % (entry, data[i * channels + j]) + fp.write('%s\n' % entry) + fp.write('\n') + + +def write_CTL_1d(filename, + from_min, + from_max, + data, + entries, + channels, + components=3): + """ + Object description. + + Parameters + ---------- + parameter : type + Parameter description. + + Returns + ------- + type + Return value description. + """ + + # May want to use fewer components than there are channels in the data + # Most commonly used for single channel LUTs + components = min(3, components, channels) + + with open(filename, 'w') as fp: + fp.write('// %d x %d LUT generated by "generate_lut"\n' % ( + entries, components)) + fp.write('\n') + fp.write('const float min1d = %3.9f;\n' % from_min) + fp.write('const float max1d = %3.9f;\n' % from_max) + fp.write('\n') + + # Write LUT + if components == 1: + fp.write('const float lut[] = {\n') + for i in range(0, entries): + fp.write('%s' % data[i * channels]) + if i != (entries - 1): + fp.write(',') + fp.write('\n') + fp.write('};\n') + fp.write('\n') + else: + for j in range(components): + fp.write('const float lut%d[] = {\n' % j) + for i in range(0, entries): + fp.write('%s' % data[i * channels]) + if i != (entries - 1): + fp.write(',') + fp.write('\n') + fp.write('};\n') + fp.write('\n') + + fp.write('void main\n') + fp.write('(\n') + fp.write(' input varying float rIn,\n') + fp.write(' input varying float gIn,\n') + fp.write(' input varying float bIn,\n') + fp.write(' input varying float aIn,\n') + fp.write(' output varying float rOut,\n') + fp.write(' output varying float gOut,\n') + fp.write(' output varying float bOut,\n') + fp.write(' output varying float aOut\n') + fp.write(')\n') + fp.write('{\n') + fp.write(' float r = rIn;\n') + fp.write(' float g = gIn;\n') + fp.write(' float b = bIn;\n') + fp.write('\n') + fp.write(' // Apply LUT\n') + if components == 1: + fp.write(' r = lookup1D(lut, min1d, max1d, r);\n') + fp.write(' g = lookup1D(lut, min1d, max1d, g);\n') + fp.write(' b = lookup1D(lut, min1d, max1d, b);\n') + elif components == 3: + fp.write(' r = lookup1D(lut0, min1d, max1d, r);\n') + fp.write(' g = lookup1D(lut1, min1d, max1d, g);\n') + fp.write(' b = lookup1D(lut2, min1d, max1d, b);\n') + fp.write('\n') + fp.write(' rOut = r;\n') + fp.write(' gOut = g;\n') + fp.write(' bOut = b;\n') + fp.write(' aOut = aIn;\n') + fp.write('}\n') + + +def write_1d(filename, + from_min, + from_max, + data, + data_entries, + data_channels, + lut_components=3, + format='spi1d'): + """ + Object description. + + Parameters + ---------- + parameter : type + Parameter description. + + Returns + ------- + type + Return value description. + """ + + ocioFormatsToExtensions = {'cinespace': 'csp', + 'flame': '3dl', + 'icc': 'icc', + 'houdini': 'lut', + 'lustre': '3dl', + 'ctl': 'ctl'} + + if format in ocioFormatsToExtensions: + if ocioFormatsToExtensions[format] == 'csp': + write_CSP_1d(filename, + from_min, + from_max, + data, + data_entries, + data_channels, + lut_components) + elif ocioFormatsToExtensions[format] == 'ctl': + write_CTL_1d(filename, + from_min, + from_max, + data, + data_entries, + data_channels, + lut_components) + else: + write_SPI_1d(filename, + from_min, + from_max, + data, + data_entries, + data_channels, + lut_components) def generate_1d_LUT_from_image(ramp_1d_path, output_path=None, - min_value=0.0, - max_value=1.0): + min_value=0, + max_value=1, + channels=3, + format='spi1d'): """ Object description. @@ -133,25 +346,21 @@ def generate_1d_LUT_from_image(ramp_1d_path, """ if output_path is None: - output_path = ramp_1d_path + ".spi1d" + output_path = '%s.%s' % (ramp_1d_path, 'spi1d') - # open image ramp = oiio.ImageInput.open(ramp_1d_path) - # get image specs - spec = ramp.spec() - type = spec.format.basetype - width = spec.width - height = spec.height - channels = spec.nchannels + ramp_spec = ramp.spec() + ramp_width = ramp_spec.width + ramp_channels = ramp_spec.nchannels - # get data - # Force data to be read as float. The Python API doesn't handle - # half-floats well yet. + # Forcibly read data as float, the Python API doesn't handle half-float + # well yet. type = oiio.FLOAT - data = ramp.read_image(type) + ramp_data = ramp.read_image(type) - write_SPI_1d(output_path, min_value, max_value, data, width, channels) + write_1d(output_path, min_value, max_value, + ramp_data, ramp_width, ramp_channels, channels, format) def generate_3d_LUT_image(ramp_3d_path, resolution=32): @@ -169,20 +378,23 @@ def generate_3d_LUT_image(ramp_3d_path, resolution=32): Return value description. """ - args = ["--generate", - "--cubesize", + args = ['--generate', + '--cubesize', str(resolution), - "--maxwidth", + '--maxwidth', str(resolution * resolution), - "--output", + '--output', ramp_3d_path] - lut_extract = Process(description="generate a 3d LUT image", - cmd="ociolutimage", + lut_extract = Process(description='generate a 3d LUT image', + cmd='ociolutimage', args=args) lut_extract.execute() -def generate_3d_LUT_from_image(ramp_3d_path, output_path=None, resolution=32): +def generate_3d_LUT_from_image(ramp_3d_path, + output_path=None, + resolution=32, + format='spi3d'): """ Object description. @@ -198,30 +410,67 @@ def generate_3d_LUT_from_image(ramp_3d_path, output_path=None, resolution=32): """ if output_path is None: - output_path = ramp_3d_path + ".spi3d" + output_path = '%s.%s' % (ramp_3d_path, 'spi3d') + + ocioFormatsToExtensions = {'cinespace': 'csp', + 'flame': '3dl', + 'icc': 'icc', + 'houdini': 'lut', + 'lustre': '3dl'} + + if format == 'spi3d' or not (format in ocioFormatsToExtensions): + # Extract a spi3d LUT + args = ['--extract', + '--cubesize', + str(resolution), + '--maxwidth', + str(resolution * resolution), + '--input', + ramp_3d_path, + '--output', + output_path] + lut_extract = Process(description='extract a 3d LUT', + cmd='ociolutimage', + args=args) + lut_extract.execute() - args = ["--extract", - "--cubesize", - str(resolution), - "--maxwidth", - str(resolution * resolution), - "--input", - ramp_3d_path, - "--output", - output_path] - lut_extract = Process(description="extract a 3d LUT", - cmd="ociolutimage", - args=args) - lut_extract.execute() + else: + output_path_spi3d = '%s.%s' % (output_path, 'spi3d') + + # Extract a spi3d LUT + args = ['--extract', + '--cubesize', + str(resolution), + '--maxwidth', + str(resolution * resolution), + '--input', + ramp_3d_path, + '--output', + output_path_spi3d] + lut_extract = Process(description='extract a 3d LUT', + cmd='ociolutimage', + args=args) + lut_extract.execute() + + # Convert to a different format + args = ['--lut', + output_path_spi3d, + '--format', + format, + output_path] + lut_convert = Process(description='convert a 3d LUT', + cmd='ociobakelut', + args=args) + lut_convert.execute() def apply_CTL_to_image(input_image, output_image, - ctl_paths=[], - input_scale=1.0, - output_scale=1.0, - global_params={}, - aces_CTL_directory=None): + ctl_paths=None, + input_scale=1, + output_scale=1, + global_params=None, + aces_ctl_directory=None): """ Object description. @@ -236,32 +485,34 @@ def apply_CTL_to_image(input_image, Return value description. """ + if ctl_paths is None: + ctl_paths = [] + if global_params is None: + global_params = {} + if len(ctl_paths) > 0: ctlenv = os.environ - if aces_CTL_directory != None: - if os.path.split(aces_CTL_directory)[1] != "utilities": - ctl_module_path = "%s/utilities" % aces_CTL_directory + if aces_ctl_directory is not None: + if os.path.split(aces_ctl_directory)[1] != 'utilities': + ctl_module_path = os.path.join(aces_ctl_directory, 'utilities') else: - ctl_module_path = aces_CTL_directory + ctl_module_path = aces_ctl_directory ctlenv['CTL_MODULE_PATH'] = ctl_module_path args = [] for ctl in ctl_paths: args += ['-ctl', ctl] - args += ["-force"] - # args += ["-verbose"] - args += ["-input_scale", str(input_scale)] - args += ["-output_scale", str(output_scale)] - args += ["-global_param1", "aIn", "1.0"] + args += ['-force'] + args += ['-input_scale', str(input_scale)] + args += ['-output_scale', str(output_scale)] + args += ['-global_param1', 'aIn', '1.0'] for key, value in global_params.iteritems(): - args += ["-global_param1", key, str(value)] + args += ['-global_param1', key, str(value)] args += [input_image] args += [output_image] - # print("args : %s" % args) - - ctlp = Process(description="a ctlrender process", - cmd="ctlrender", + ctlp = Process(description='a ctlrender process', + cmd='ctlrender', args=args, env=ctlenv) ctlp.execute() @@ -283,12 +534,12 @@ def convert_bit_depth(input_image, output_image, depth): """ args = [input_image, - "-d", + '-d', depth, - "-o", + '-o', output_image] - convert = Process(description="convert image bit depth", - cmd="oiiotool", + convert = Process(description='convert image bit depth', + cmd='oiiotool', args=args) convert.execute() @@ -297,13 +548,15 @@ def generate_1d_LUT_from_CTL(lut_path, ctl_paths, lut_resolution=1024, identity_LUT_bit_depth='half', - input_scale=1.0, - output_scale=1.0, - global_params={}, + input_scale=1, + output_scale=1, + global_params=None, cleanup=True, - aces_CTL_directory=None, - min_value=0.0, - max_value=1.0): + aces_ctl_directory=None, + min_value=0, + max_value=1, + channels=3, + format='spi1d'): """ Object description. @@ -318,38 +571,40 @@ def generate_1d_LUT_from_CTL(lut_path, Return value description. """ - # print(lutPath) - # print(ctlPaths) + if global_params is None: + global_params = {} lut_path_base = os.path.splitext(lut_path)[0] - identity_LUT_image_float = lut_path_base + ".float.tiff" + identity_LUT_image_float = '%s.%s.%s' % (lut_path_base, 'float', 'tiff') generate_1d_LUT_image(identity_LUT_image_float, lut_resolution, min_value, max_value) - if identity_LUT_bit_depth != 'half': - identity_LUT_image = lut_path_base + ".uint16.tiff" + if identity_LUT_bit_depth not in ['half', 'float']: + identity_LUT_image = '%s.%s.%s' % (lut_path_base, 'uint16', 'tiff') convert_bit_depth(identity_LUT_image_float, identity_LUT_image, identity_LUT_bit_depth) else: identity_LUT_image = identity_LUT_image_float - transformed_LUT_image = lut_path_base + ".transformed.exr" + transformed_LUT_image = '%s.%s.%s' % (lut_path_base, 'transformed', 'exr') apply_CTL_to_image(identity_LUT_image, transformed_LUT_image, ctl_paths, input_scale, output_scale, global_params, - aces_CTL_directory) + aces_ctl_directory) generate_1d_LUT_from_image(transformed_LUT_image, lut_path, min_value, - max_value) + max_value, + channels, + format) if cleanup: os.remove(identity_LUT_image) @@ -375,40 +630,29 @@ def correct_LUT_image(transformed_LUT_image, Return value description. """ - # open image transformed = oiio.ImageInput.open(transformed_LUT_image) - # get image specs transformed_spec = transformed.spec() - type = transformed_spec.format.basetype width = transformed_spec.width height = transformed_spec.height channels = transformed_spec.nchannels - # rotate or not if width != lut_resolution * lut_resolution or height != lut_resolution: - print(("Correcting image as resolution is off. " - "Found %d x %d. Expected %d x %d") % ( + print(('Correcting image as resolution is off. ' + 'Found %d x %d. Expected %d x %d') % ( width, height, lut_resolution * lut_resolution, lut_resolution)) - print("Generating %s" % corrected_LUT_image) + print('Generating %s' % corrected_LUT_image) - # - # We're going to generate a new correct image - # - - # Get the source data - # Force data to be read as float. The Python API doesn't handle - # half-floats well yet. + # Forcibly read data as float, the Python API doesn't handle half-float + # well yet. type = oiio.FLOAT source_data = transformed.read_image(type) - format = os.path.splitext(corrected_LUT_image)[1] correct = oiio.ImageOutput.create(corrected_LUT_image) - # set image specs correct_spec = oiio.ImageSpec() correct_spec.set_format(oiio.FLOAT) correct_spec.width = height @@ -417,14 +661,13 @@ def correct_LUT_image(transformed_LUT_image, correct.open(corrected_LUT_image, correct_spec, oiio.Create) - dest_data = array.array("f", - ("\0" * correct_spec.width * + dest_data = array.array('f', + ('\0' * correct_spec.width * correct_spec.height * correct_spec.nchannels * 4)) for j in range(0, correct_spec.height): for i in range(0, correct_spec.width): for c in range(0, correct_spec.nchannels): - # print(i, j, c) dest_data[(correct_spec.nchannels * correct_spec.width * j + correct_spec.nchannels * i + c)] = ( @@ -447,11 +690,12 @@ def generate_3d_LUT_from_CTL(lut_path, ctl_paths, lut_resolution=64, identity_LUT_bit_depth='half', - input_scale=1.0, - output_scale=1.0, - global_params={}, + input_scale=1, + output_scale=1, + global_params=None, cleanup=True, - aces_CTL_directory=None): + aces_ctl_directory=None, + format='spi3d'): """ Object description. @@ -466,40 +710,42 @@ def generate_3d_LUT_from_CTL(lut_path, Return value description. """ - # print(lutPath) - # print(ctlPaths) + if global_params is None: + global_params = {} lut_path_base = os.path.splitext(lut_path)[0] - identity_LUT_image_float = lut_path_base + ".float.tiff" + identity_LUT_image_float = '%s.%s.%s' % (lut_path_base, 'float', 'tiff') generate_3d_LUT_image(identity_LUT_image_float, lut_resolution) - if identity_LUT_bit_depth != 'half': - identity_LUT_image = (lut_path_base + - "." + - identity_LUT_bit_depth + - ".tiff") + if identity_LUT_bit_depth not in ['half', 'float']: + identity_LUT_image = '%s.%s.%s' % (lut_path_base, + identity_LUT_bit_depth, + 'tiff') convert_bit_depth(identity_LUT_image_float, identity_LUT_image, identity_LUT_bit_depth) else: identity_LUT_image = identity_LUT_image_float - transformed_LUT_image = lut_path_base + ".transformed.exr" + transformed_LUT_image = '%s.%s.%s' % (lut_path_base, 'transformed', 'exr') apply_CTL_to_image(identity_LUT_image, transformed_LUT_image, ctl_paths, input_scale, output_scale, global_params, - aces_CTL_directory) + aces_ctl_directory) - corrected_LUT_image = lut_path_base + ".correct.exr" + corrected_LUT_image = '%s.%s.%s' % (lut_path_base, 'correct', 'exr') corrected_LUT_image = correct_LUT_image(transformed_LUT_image, corrected_LUT_image, lut_resolution) - generate_3d_LUT_from_image(corrected_LUT_image, lut_path, lut_resolution) + generate_3d_LUT_from_image(corrected_LUT_image, + lut_path, + lut_resolution, + format) if cleanup: os.remove(identity_LUT_image) @@ -508,7 +754,9 @@ def generate_3d_LUT_from_CTL(lut_path, os.remove(transformed_LUT_image) if corrected_LUT_image != transformed_LUT_image: os.remove(corrected_LUT_image) - # os.remove(correctedLUTImage) + if format != 'spi3d': + lut_path_spi3d = '%s.%s' % (lut_path, 'spi3d') + os.remove(lut_path_spi3d) def main(): @@ -534,32 +782,31 @@ def main(): version='0.01', usage='%prog [options]') - p.add_option('--lut', '-l', type="string", default="") - p.add_option('--ctl', '-c', type="string", action="append") - p.add_option('--lut_resolution_1d', '', type="int", default=1024) - p.add_option('--lut_resolution_3d', '', type="int", default=33) - p.add_option('--ctlReleasePath', '-r', type="string", default="") - p.add_option('--bitDepth', '-b', type="string", default="float") - p.add_option('--keepTempImages', '', action="store_true") - p.add_option('--minValue', '', type="float", default=0.0) - p.add_option('--maxValue', '', type="float", default=1.0) - p.add_option('--inputScale', '', type="float", default=1.0) - p.add_option('--outputScale', '', type="float", default=1.0) - p.add_option('--ctlRenderParam', '-p', type="string", nargs=2, - action="append") - - p.add_option('--generate1d', '', action="store_true") - p.add_option('--generate3d', '', action="store_true") + p.add_option('--lut', '-l', type='string', default='') + p.add_option('--format', '-f', type='string', default='') + p.add_option('--ctl', '-c', type='string', action='append') + p.add_option('--lutResolution1d', '', type='int', default=1024) + p.add_option('--lutResolution3d', '', type='int', default=33) + p.add_option('--ctlReleasePath', '-r', type='string', default='') + p.add_option('--bitDepth', '-b', type='string', default='float') + p.add_option('--keepTempImages', '', action='store_true') + p.add_option('--minValue', '', type='float', default=0) + p.add_option('--maxValue', '', type='float', default=1) + p.add_option('--inputScale', '', type='float', default=1) + p.add_option('--outputScale', '', type='float', default=1) + p.add_option('--ctlRenderParam', '-p', type='string', nargs=2, + action='append') + + p.add_option('--generate1d', '', action='store_true') + p.add_option('--generate3d', '', action='store_true') options, arguments = p.parse_args() - # - # Get options - # lut = options.lut + format = options.format ctls = options.ctl - lut_resolution_1d = options.lut_resolution_1d - lut_resolution_3d = options.lut_resolution_3d + lut_resolution_1d = options.lutResolution1d + lut_resolution_3d = options.lutResolution3d min_value = options.minValue max_value = options.maxValue input_scale = options.inputScale @@ -567,11 +814,11 @@ def main(): ctl_release_path = options.ctlReleasePath generate_1d = options.generate1d is True generate_3d = options.generate3d is True - bitdepth = options.bitDepth + bit_depth = options.bitDepth cleanup = not options.keepTempImages params = {} - if options.ctlRenderParam != None: + if options.ctlRenderParam is not None: for param in options.ctlRenderParam: params[param[0]] = float(param[1]) @@ -582,57 +829,54 @@ def main(): args_start = len(sys.argv) + 1 args = [] - # print("command line : \n%s\n" % " ".join(sys.argv)) - - # - # Generate LUTs - # if generate_1d: - print("1D LUT generation options") + print('1D LUT generation options') else: - print("3D LUT generation options") - - print("lut : %s" % lut) - print("ctls : %s" % ctls) - print("lut res 1d : %s" % lut_resolution_1d) - print("lut res 3d : %s" % lut_resolution_3d) - print("min value : %s" % min_value) - print("max value : %s" % max_value) - print("input scale : %s" % input_scale) - print("output scale : %s" % output_scale) - print("ctl render params : %s" % params) - print("ctl release path : %s" % ctl_release_path) - print("bit depth of input : %s" % bitdepth) - print("cleanup temp images : %s" % cleanup) + print('3D LUT generation options') + + print('lut : %s' % lut) + print('format : %s' % format) + print('ctls : %s' % ctls) + print('lut res 1d : %s' % lut_resolution_1d) + print('lut res 3d : %s' % lut_resolution_3d) + print('min value : %s' % min_value) + print('max value : %s' % max_value) + print('input scale : %s' % input_scale) + print('output scale : %s' % output_scale) + print('ctl render params : %s' % params) + print('ctl release path : %s' % ctl_release_path) + print('bit depth of input : %s' % bit_depth) + print('cleanup temp images : %s' % cleanup) if generate_1d: generate_1d_LUT_from_CTL(lut, ctls, lut_resolution_1d, - bitdepth, + bit_depth, input_scale, output_scale, params, cleanup, ctl_release_path, min_value, - max_value) + max_value, + format=format) elif generate_3d: generate_3d_LUT_from_CTL(lut, ctls, lut_resolution_3d, - bitdepth, + bit_depth, input_scale, output_scale, params, cleanup, - ctl_release_path) + ctl_release_path, + format=format) else: - print(("\n\nNo LUT generated. " - "You must choose either 1D or 3D LUT generation\n\n")) + print(('\n\nNo LUT generated. ' + 'You must choose either 1D or 3D LUT generation\n\n')) if __name__ == '__main__': main() -