I got the image like this (it's a graph):
Gold Trade Graph http://www.kitconet.com/charts/metals/platinum/tny_pt_en_caoz_2.gif
I want to change the colours, so the white is black, the graph line is light blue, etc.. is it possible to achieve with GD and PHP?
I'm not aware of any ready-made functions. But I suppose you could go trough every pixel of the image and change it's colour...
You could try the imagefilter function http://lv.php.net/imagefilter - but that will not give your direct access to replace one color with another, just changing the r/g/b components.
A very low level solution could be implemented using imagesetpixel http://nl2.php.net/imagesetpixel to set the new pixel values.
I had trouble making this solution work. The image cannot be a true color image. Convert it first with imagetruecolortopalette();
I know this is late and after the fact, but I've put together a script that will do this on a slightly larger scale. Hopefully someone who comes across this post can use it. It takes an number of source images that are one-color layers (your choice). You provide it with a source color and the tint of each layer and the script returns a composite image (with full transparency) colored specifically to your provided hex code.
Check out the code below. A more detailed explanation can be found on my blog.
The slow but sure approach, iterating over every pixel.
This will replace the white color with Gray