T
T
Temi2016-01-04 14:26:39
PHP
Temi, 2016-01-04 14:26:39

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

3 answer(s)
N
newobj, 2016-01-04
@newobj

algolist.manual.ru/graphics/find_col.php

R
romy4, 2016-01-04
@romy4

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

D
Dmitry Bay, 2016-01-04
@kawabanga

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 question

Ask a Question

731 491 924 answers to any question