title: How do I convert any image to a 4-color paletted image using the Python Imaging Library?
body: <p>I have a device that supports 4-color graphics (much like CGA in the old days).</p>
  
  <p>I wanted to use <a href="http://www.pythonware.com/products/pil/" rel="noreferrer">PIL</a> to read the image and convert it using my 4-color palette (of red, green, yellow, black), but I can't figure out if it's even possible at all.  I found some mailing list archive posts that seem to suggest other people have tried to do so and failed.</p>
  
  <p>A simple python example would be much appreciated!</p>
  
  <p>Bonus points if you add something that then converts the image to a byte string where each byte represents 4 pixels of data (with each two bits representing a color from 0 to 3)</p>