title: PIL: Convert RGB image to a specific 8-bit palette?
body: <p>Using the Python Imaging Library, I can call</p>
  
  <pre><code>img.convert("P", palette=Image.ADAPTIVE)
  </code></pre>
  
  <p>or</p>
  
  <pre><code>img.convert("P", palette=Image.WEB)
  </code></pre>
  
  <p>but is there a way to convert to an arbitrary palette?</p>
  
  <pre><code>p = []
  for i in range(0, 256):
      p.append(i, 0, 0)
  img.convert("P", palette=p)
  </code></pre>
  
  <p>where it'll map each pixel to the closest colour found in the image? Or is this supported for <code>Image.WEB</code> and nothing else?</p>