Question: I got the image like this (it's a graph):

[![Gold Trade Graph](https://i.stack.imgur.com/vyayH.gif)](https://i.stack.imgur.com/vyayH.gif)  

(source: [kitconet.com](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?

Answer: 
I had trouble making this solution work. The image cannot be a true color image. Convert it first with imagetruecolortopalette();

```
$imgname = "test.gif";
$im = imagecreatefromgif ($imgname);

imagetruecolortopalette($im,false, 255);

$index = imagecolorclosest ( $im,  255,255,255 ); // get White COlor
imagecolorset($im,$index,92,92,92); // SET NEW COLOR

$imgname = "result.gif";
imagegif($im, $imgname ); // save image as gif
imagedestroy($im);

```
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...