How to convert image.RGBA (image.Image) to image.Paletted?
<p>I'm trying to create an animated GIF from a series of arbitrary non-paletted images. In order to create a paletted image, I need to come up with a palette somehow.</p>
<pre><code>// RGBA, etc. images from somewhere else
var frames []image.Image

outGif := &amp;gif.GIF{}
for _, simage := range frames {
  // TODO: Convert image to paletted image
  // bounds := simage.Bounds()
  // palettedImage := image.NewPaletted(bounds, ...)

  // Add new frame to animated GIF
  outGif.Image = append(outGif.Image, palettedImage)
  outGif.Delay = append(outGif.Delay, 0)
}
gif.EncodeAll(w, outGif)
</code></pre>
<p>Is there an easy way in golang stdlib to accomplish this?</p>