So what you want to do is use GD Lib to generate your image (most likely)...
When a user hits the image request it's actually parsed as PHP (assuming you're using PHP)... The script does an IP lookup against the installed Geo IP DB and then creates an image on the fly that has the info in it. The header type is changed to whatever you're outputting your image as and then the content is served up.
I could create this for you if you'd like, hit me up on ICQ
