%matplotlib inline from colour.plotting import * # Thanks to http://colour-science.org/ colourspaces_CIE_1931_chromaticity_diagram_plot( ['sRGB', 'DCI-P3', 'Rec. 2020', 'ACES RGB', 'Pointer Gamut']) import pylab, random, numpy as np from colour.models import RGB_to_RGB, XYZ_to_xyY # Draw the DCI-P3 and ACES gamut boundaries. CIE_1931_chromaticity_diagram_plot(standalone=False) aces = get_RGB_colourspace('ACES') dcip3 = get_RGB_colourspace('DCI-P3') pylab.fill(aces.primaries[:,0], aces.primaries[:,1], color='red', label='ACES Gamut', fill=False) pylab.fill(dcip3.primaries[:,0], dcip3.primaries[:,1], color='green', label='DCI-P3 Gamut', fill=False) # Pick some reasonably saturated sample # colors in the P3 color-space. samples = [[0.2, 0.4, 0.7], [0.6, 0.9, 0.4], [0.7, 0.2, 0.6]] for i, p3Col in enumerate(samples): # Convert to ACES without chromatic adaption, for clarity. acesCol = np.dot(np.dot(aces.to_RGB, dcip3.to_XYZ), p3Col) # Repeatedly multiply the color in each space by itself. p3Cols = [[pow(c, e) for c in p3Col] for e in range(1,5)] acesCols = [[pow(c, e) for c in acesCol] for e in range(1,5)] # Convert to xyY and plot the results resultsP3 = np.array([XYZ_to_xyY(np.dot(dcip3.to_XYZ, c)) for c in p3Cols]) resultsACES = np.array([XYZ_to_xyY(np.dot(aces.to_XYZ, c)) for c in acesCols]) pylab.plot(resultsP3[:,0], resultsP3[:,1], 'o-', color='green', linewidth=2, label='' if i else "DCI-P3 Self-multiplication") pylab.plot(resultsACES[:,0], resultsACES[:,1], 'o-', color='red', linewidth=2, label='' if i else "ACES Self-multiplication") settings = {} settings.update({'legend': True, 'standalone': True, 'x_tighten': True, 'y_tighten': True, 'margins': [-0.1, 0.05, -0.15, 0.05]}) bounding_box(**settings); aspect(**settings); display(**settings) from IPython.display import Image Image('../nuke/p3_vs_aces/p3_render_p3_texture_annotated.png') from IPython.display import Image Image('../nuke/p3_vs_aces/aces_render_aces_texture_annotated.png') p3Red = [0.9, 0.1, 0.1] acesRed = RGB_to_RGB(p3Red, dcip3, aces) print 'DCI-P3 value:', p3Red print 'ACES value: ', acesRed Image('../nuke/p3_vs_aces/aces_render_p3_texture_annotated2.png')