Converting PixelFormat from RGB565 to RGB888 C#
<p>I am working on a device that is using an image sensor and a USB microcontroller that will continuously stream frames from the sensor to be drawn on a GUI using C#.  </p>

<p>My image sensor is outputing data in RGB565, and I am converting this array of bytes to an image using the following function:</p>

<pre><code>public static Bitmap BytesToBmp(byte[] bmpBytes, int w, int h)
{
    Bitmap functionReturnValue = default(Bitmap);
    Bitmap bmp = new Bitmap(w, h ,System.Drawing.Imaging.PixelFormat.Format16bppRgb565);

    System.Drawing.Imaging.BitmapData bdata = bmp.LockBits(new Rectangle(new Point(), bmp.Size), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format16bppRgb565);
    Marshal.Copy(bmpBytes, 0, bdata.Scan0, bmpBytes.Length - 1);
    bmp.UnlockBits(bdata);
    functionReturnValue = bmp;

    return functionReturnValue;
}
</code></pre>

<p>Unfortantely I am getting a very pink image and wanted to try and fix this by converting the image from RBG565 to RGB888.  Let me know if you have any suggestions.</p>
