people of the internet! I'm making a program that needs to try and find the closest RGB match of lots of pixels, using Jimp.
Say if you had a color that was slightly purple, I would want to change it to the purple that I have in my table, here:
var colors = [
[0,0,255,0],
[1,255,165,0],
[2,0,0,255],
[3,255,192,203],
[4,165,42,42],
[5,255,255,255],
[6,0,0,0],
[7,230,230,350],
[8,255,255,0],
[9,0,0,0],
]
(the first number in one of these arrays can be ignored, the rest are just R, G, and B)
So if I had a red like (255,7,1) I would like to match that to the red in my table, being (255,0,0)
I have tried something, but rather it was very dumb and didn't work, so I will spare you the details.
Can anybody help me? Thanks!