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

Gold Trade Graph

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?

Accepted Answer

This will replace the white color with Gray

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

$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

alt text

Written by Luis Melgratti
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki