title: Creating 8-bit images
body: <p>I'm trying to create an 8-bit image with a solid background color. It seems like it should be pretty straight forward but the details on the file list it as 32-bit color depth. What am I missing?</p>
  
  <pre><code>    public void CreateImage()
      {
          var bmpOut = new Bitmap(300, 300);
          var g = Graphics.FromImage(bmpOut);
          g.FillRectangle(new SolidBrush(Color.Gray), 0, 0, 300, 300);
  
          var stream = new MemoryStream();
          bmpOut.Save(stream, GetPngCodecInfo(), GetEncoderParameters());
  
          bmpOut.Save(@"C:\image.png", GetPngCodecInfo(), GetEncoderParameters());
      }
  
      public EncoderParameters GetEncoderParameters()
      {
          var parameters = new EncoderParameters();
          parameters.Param[0] = new EncoderParameter(Encoder.ColorDepth, 8);
  
          return parameters;
      }
  
      public ImageCodecInfo GetPngCodecInfo()
      {
          var encoders = ImageCodecInfo.GetImageEncoders();
  
          ImageCodecInfo codecInfo = null;
  
          foreach (var imageCodecInfo in encoders)
          {
              if (imageCodecInfo.FormatID != ImageFormat.Png.Guid)
                  continue;
  
              codecInfo = imageCodecInfo;
              break;
          }
  
          return codecInfo;
      }
  </code></pre>