Answer the question
In order to leave comments, you need to log in
How to plot an image with other PHP colors?
I have an array with rgb colors (I can overwrite it in hex, in general the format is not important).
I need to loop through an image pixel by pixel and replace with the most similar color in an array.
The problem is finding a similar color.
Urgently! If anyone has any thoughts, I would be very grateful.
Answer the question
In order to leave comments, you need to log in
what is so difficult? each color in hex. then by enumeration you subtract the color of the array from the original one. where modulo is the smallest result, then it fits
the first thing that comes to mind in your replacement is
hex numbers to dec translate ( us2.php.net/manual/en/function.hexdec.php ), sort the array by color value. And search to find the number closest to the given number.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question