Tile-based Image Quantization Tool
This tool is mostly meant for GBA/NDS graphics, where each 'tile' can use one of many palettes. However, it can be adapted to just about any use (for example, custom formats).
Run make
to build the tool, then call tilequant Input.bmp Output.bmp (no. of palettes) (entries/palette)