Monthly Archives: January 2004

A Dynamically Colored Map

This is a very simple program that I wrote that lets you dynamically modify the colors of images. I wrote it mainly for fun to provide a neat mapping feature to the website Where’s George? that lets users track where dollar bills travel around the US and other countries. Since I’ve heard from a number of people asking for details as to how I did this I decided to make the code available for free under the GNU GPL, so here it is…

What this code lets you do is create a map of the US like the one below in which the color of each state can be changed dynamically. If you look at the source of this HTML page you’ll see that this isn’t just a static JPEG but instead is made by a call to a CGI script that defines the colors for each state (with gray being the default):

The URL for the above image is :

Feel free to cut & paste the URL into your browser and change the values. You can set any state using the abbreviations in the map to any value between 1 and 6. The program lets you set colors to any RGB value but for simplicity and security the CGI script only defines six colors.

Source code for the program can be downloaded here.