i have a list of RGB colors and need to draw gradient between them in python. Have you any suggestions how to make it usin PIL library?
EDIT: I get this:
def gradient(list_of_colors):
width = 600
height = 480
img = Image.new("RGB", (width, height))
draw = ImageDraw.Draw(img)
for i in range(len(list_of_colors)):
r1,g1,b1 = list_of_colors[i]
for x in range(width/len(list_of_colors)):
colour = (r1,g1,b1)
draw.line((x+(width/len(list_of_colors)*i), 0, x+(width/len(list_of_colors)*i), height), fill=colour)
img.show()
gradient([(30, 198, 244), (99, 200, 72),(120, 50, 80),(200, 90, 140)])
and it draw me this: http://img59.imageshack.us/img59/1852/3gba.png
I just need to make it gradient between those colors not stripes of colors. (something like this) http://www.kees-tm.nl/uploads/colorgradient.jpg