Convert 24-bit bmp to 16-bit?

The Format16bppRgb1555 pixel format is declared but GDI+ doesn’t actually support it. There is no main-stream video driver or image codec that ever used that pixel format. Something that the GDI+ designers guessed could have happened, their time machine wasn’t accurate enough. Otherwise a pretty sloppy copy/paste from the programmer that worked on System.Drawing.

Rgb555 is the closest match for available hardware and codecs:

public 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;
}

Leave a Comment