title: C# - Copy an Image into an 8-bit Indexed Image
body: <p>I want to create an 8-bit indexed image from a regular 32-bit Image object.</p>
  
  <pre><code>Bitmap img = new Bitmap(imgPath); // 32-bit
  Bitmap img8bit = new Bitmap(imgW, imgH, Format8bppIndexed); // 8-bit
  
  // copy img to img8bit -- HOW?
  
  img8bit.Save(imgNewPath, ImageFormat.Png);
  </code></pre>
  
  <p>I cannot use SetPixel to copy it over pixel-by-pixel since Graphics doesn't work with indexed images.</p>
  
  <p>How else? </p>