title: save jpg with lower bit depth (24 to 16 for instance) (C#)
body: <p>I need to convert 24- and 32-bits jpeg and png-files to a lower bit depth (16). I found some code to do this, but the resulting images keep the bit depth of the original file although there file size is lower.  </p>
  
  <pre><code>Image img = Image.FromFile(filePathOriginal);
  Bitmap bmp = ConvertTo16bpp(img);
  EncoderParameters parameters = new EncoderParameters();
  parameters.Param[0] = new EncoderParameter(Encoder.ColorDepth, 16);
  bmp.Save(filePathNew, jpgCodec, parameters);
  bmp.Dispose();
  img.Dispose();
  
  ...
  
  private static Bitmap ConvertTo16bpp(Image img) {
      var bmp = new Bitmap(img.Width, img.Height, System.Drawing.Imaging.PixelFormat.Format16bppRgb555);
      using (var gr = Graphics.FromImage(bmp))
      {
           gr.DrawImage(img, new Rectangle(0, 0, img.Width, img.Height));
      }
  
      return bmp;
  }
  </code></pre>
  
  <p>Any ideas what's going wrong?</p>
  
  <p>Thanks,
  Frank</p>