Skip to content

Instantly share code, notes, and snippets.

@KelSolaar
Created January 12, 2018 23:10
Show Gist options
  • Save KelSolaar/e292c651b5633fc8042b6f227f1b1be2 to your computer and use it in GitHub Desktop.
Save KelSolaar/e292c651b5633fc8042b6f227f1b1be2 to your computer and use it in GitHub Desktop.
Image Sequence to Chromaticity Diagram
import glob
import os
import colour
from colour.plotting import RGB_chromaticity_coordinates_chromaticity_diagram_plot_CIE1931
def image_sequence_to_chromaticity_diagram(images,
output_directory,
input_colourspace='sRGB',
output_colourspace='sRGB'):
for image in images:
RGB = colour.read_image(image)
RGB = colour.RGB_to_RGB(RGB,
colour.RGB_COLOURSPACES[input_colourspace],
colour.RGB_COLOURSPACES[output_colourspace])
diagram_filename = os.path.join(
output_directory, '{0}.chromaticity_diagram.png'.format(
os.path.splitext(os.path.basename(image))[0]))
RGB_chromaticity_coordinates_chromaticity_diagram_plot_CIE1931(
RGB, output_colourspace, filename=diagram_filename)
PNG_FILES = glob.glob(
'/Users/kelsolaar/Documents/Development/colour-science/colour-ramblings/resources/images/colour_wheel/*.png'
)
image_sequence_to_chromaticity_diagram(
PNG_FILES,
'/Users/kelsolaar/Documents/Development/colour-science/colour-ramblings/resources/images/colour_wheel/'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment