title: Changing palette's of 8-bit .png images using python PIL
body: <p>I'm looking for a fast way to apply a new palette to an existing 8-bit .png image. How can I do that? Is the .png re-encoded when I save the image? (Own answer: it seems so)</p>
  
  <p>What I have tried (edited):</p>
  
  <pre><code>import Image, ImagePalette
  output = StringIO.StringIO()
  palette = (.....) #long palette of 768 items
  im = Image.open('test_palette.png') #8 bit image
  im.putpalette(palette) 
  im.save(output, format='PNG')
  </code></pre>
  
  <p>With my testimage the save function takes about 65 millis. My thought: without the decoding and encoding, it can be a lot faster??</p>