diff --git a/app.py b/app.py index 5b57bbc..887ac65 100644 --- a/app.py +++ b/app.py @@ -242,8 +242,8 @@ def image_data_response(image): args.get('outOfPrimaryColourspaceGamut', False)), out_of_secondary_colourspace_gamut=_bool_to_bool( args.get('outOfSecondaryColourspaceGamut', False)), - out_of_pointer_gamut=_bool_to_bool( - args.get('outOfPointerGamut', False)), + out_of_pointer_gamut=_bool_to_bool(args.get('outOfPointerGamut', + False)), saturate=_bool_to_bool(args.get('saturate', False))) response = Response(json_data, status=200, mimetype='application/json') @@ -306,8 +306,8 @@ def RGB_image_scatter_visual_response(image): args.get('outOfPrimaryColourspaceGamut', False)), out_of_secondary_colourspace_gamut=_bool_to_bool( args.get('outOfSecondaryColourspaceGamut', False)), - out_of_pointer_gamut=_bool_to_bool( - args.get('outOfPointerGamut', False)), + out_of_pointer_gamut=_bool_to_bool(args.get('outOfPointerGamut', + False)), sub_sampling=int(args.get('subSampling', 25)), saturate=_bool_to_bool(args.get('saturate', False)), ) @@ -355,8 +355,8 @@ def pointer_gamut_visual_response(): """ args = request.args - json_data = pointer_gamut_visual( - colourspace_model=args.get('colourspaceModel', COLOURSPACE_MODEL), ) + json_data = pointer_gamut_visual(colourspace_model=args.get( + 'colourspaceModel', COLOURSPACE_MODEL), ) response = Response(json_data, status=200, mimetype='application/json') response.headers['X-Content-Length'] = len(json_data) @@ -377,8 +377,8 @@ def visible_spectrum_visual_response(): """ args = request.args - json_data = visible_spectrum_visual( - colourspace_model=args.get('colourspaceModel', COLOURSPACE_MODEL), ) + json_data = visible_spectrum_visual(colourspace_model=args.get( + 'colourspaceModel', COLOURSPACE_MODEL), ) response = Response(json_data, status=200, mimetype='application/json') response.headers['X-Content-Length'] = len(json_data) @@ -397,16 +397,16 @@ def index(): Index response. """ - return render_template( - 'index.html', - colour_analysis_js=os.environ.get('COLOUR_ANALYSIS_JS', - '/static/js/colour-analysis.js'), - image=sorted(os.listdir(IMAGES_DIRECTORY))[0], - primary_colourspace=PRIMARY_COLOURSPACE, - secondary_colourspace=SECONDARY_COLOURSPACE, - image_colourspace=IMAGE_COLOURSPACE, - image_decoding_cctf=IMAGE_CCTF_DECODING, - colourspace_model=COLOURSPACE_MODEL) + return render_template('index.html', + colour_analysis_js=os.environ.get( + 'COLOUR_ANALYSIS_JS', + '/static/js/colour-analysis.js'), + image=sorted(os.listdir(IMAGES_DIRECTORY))[0], + primary_colourspace=PRIMARY_COLOURSPACE, + secondary_colourspace=SECONDARY_COLOURSPACE, + image_colourspace=IMAGE_COLOURSPACE, + image_decoding_cctf=IMAGE_CCTF_DECODING, + colourspace_model=COLOURSPACE_MODEL) @APP.after_request diff --git a/colour_analysis.py b/colour_analysis.py index 25d2aa6..d6b37da 100644 --- a/colour_analysis.py +++ b/colour_analysis.py @@ -167,8 +167,8 @@ 'hdr-CIELAB', 'hdr-IPT'}** """ -DATA_POINTER_GAMUT = Lab_to_XYZ( - LCHab_to_Lab(DATA_POINTER_GAMUT_VOLUME), CCS_ILLUMINANT_POINTER_GAMUT) +DATA_POINTER_GAMUT = Lab_to_XYZ(LCHab_to_Lab(DATA_POINTER_GAMUT_VOLUME), + CCS_ILLUMINANT_POINTER_GAMUT) """ Pointer's Gamut data converted to *CIE XYZ* tristimulus values. @@ -250,13 +250,12 @@ def XYZ_to_colourspace_model(XYZ, illuminant, model, **kwargs): Colourspace model values. """ - ijk = convert( - XYZ, - 'CIE XYZ', - model, - illuminant=illuminant, - verbose={'mode': 'Short'}, - **kwargs) + ijk = convert(XYZ, + 'CIE XYZ', + model, + illuminant=illuminant, + verbose={'mode': 'Short'}, + **kwargs) if model == 'JzAzBz': ijk /= XYZ_to_JzAzBz([1, 1, 1])[0] @@ -447,9 +446,10 @@ def conform_primitive_dtype(primitive): vertices, faces, outline = primitive return ( - vertices.astype( - [('position', np.float32, (3, )), ('uv', np.float32, (2, )), - ('normal', np.float32, (3, )), ('colour', np.float32, (4, ))]), + vertices.astype([('position', np.float32, (3, )), + ('uv', np.float32, (2, )), + ('normal', np.float32, (3, )), + ('colour', np.float32, (4, ))]), faces.astype(np.uint32), outline.astype(np.uint32), ) @@ -582,14 +582,13 @@ def RGB_colourspace_volume_visual(colourspace=PRIMARY_COLOURSPACE, filter_RGB_colourspaces(re.escape(colourspace)).values()) cube = conform_primitive_dtype( - primitive_cube( - width_segments=segments, - height_segments=segments, - depth_segments=segments)) + primitive_cube(width_segments=segments, + height_segments=segments, + depth_segments=segments)) vertices = cube[0]['position'] + 0.5 - faces = colourspace_model_faces_reorder( - np.reshape(cube[1], (-1, 1)), colourspace_model) + faces = colourspace_model_faces_reorder(np.reshape(cube[1], (-1, 1)), + colourspace_model) RGB = cube[0]['colour'] XYZ = RGB_to_XYZ( @@ -762,14 +761,13 @@ def spectral_locus_visual(colourspace=PRIMARY_COLOURSPACE, colourspace_model, ), colourspace_model) - RGB = normalise_maximum( - XYZ_to_RGB( - XYZ, - colourspace.whitepoint, - colourspace.whitepoint, - colourspace.matrix_XYZ_to_RGB, - ), - axis=-1) + RGB = normalise_maximum(XYZ_to_RGB( + XYZ, + colourspace.whitepoint, + colourspace.whitepoint, + colourspace.matrix_XYZ_to_RGB, + ), + axis=-1) return buffer_geometry(position=vertices, color=RGB)