This Python script,, will generate map tiles from images. The script accepts a png, jpeg or any PIL-compatible image. I revisited it and noticed that it had some issues with the latest version of networkx, so I updated it. I tested this in Python 2.7.2 with networkx 1.7 and PIL installed. Here's how you use

python tileWidth tileHeight file
For example:
python 16 16 map.png

This goes hand in hand with, which will allow you to create a Tiled TMX map from the two images, in this fashion:

python 16 16 map.png map-Tileset.png