Well, you need the original image with all of its original colors.
Then you need to know what you want to dither the image to, 16bits, or 256 colors? Or, you may have a specific palette in mind, like the 216 color internet palette.
Once you have those two things, you could use the standard ordered-dither or error-diffusion-dither algorithms to dither the image on the fly (optimized implementations of these two algorithms are quite fast).