My goal is to find the closest match of RGB compared to the RGB from the array. I have already created a function that loops trough every pixel in a picture. The only thing I need now is to find closest color of each pixel in the picture to the color from the array.

$colors = array(
    array(221,221,221),
    array(219,125,62),
    array(179,80,188),
    array(107,138,201),
    array(177,166,39),
    array(65,174,56),
    array(208,132,153),
    array(64,64,64),
    array(154,161,161),
    array(46,110,137),
    array(126,61,181),
    array(46,56,141),
    array(79,50,31),
    array(53,70,27),
    array(150,52,48),
    array(25,22,22)
);

I tried converting picture to 8bits to reduce number of colors and compare them later in database but that just doesn't seem to be a good idea.

Edit
Report