Sorting a list of RGB triplets into a spectrum
问题 I have a list of RGB triplets, and I'd like to plot them in such a way that they form something like a spectrum. I've converted them to HSV, which people seem to recommend. from PIL import Image, ImageDraw import colorsys def make_rainbow_rgb(colors, width, height): """colors is an array of RGB tuples, with values between 0 and 255""" img = Image.new("RGBA", (width, height)) canvas = ImageDraw.Draw(img) def hsl(x): to_float = lambda x : x / 255.0 (r, g, b) = map(to_float, x) h, s, l =