Out of Memory / OutOfMemoryException on Graphics.FromImage with PixelFormat.Format16bppArgb1555 or PixelFormat.Format16bppGrayScale
If you have some code like this:
Bitmap bmp = new Bitmap(100,100, PixelFormat.Format16bppArgb1555);
Graphics gfx = Graphics.FromImage(bmp);
You will find you get an out of memory exception upon executing the code. The reason? .NET does not actually support Format16bppArgb1555 or PixelFormat.Format16bppGrayScale.
Bitmap bmp = new Bitmap(100,100, PixelFormat.Format16bppArgb1555);
Graphics gfx = Graphics.FromImage(bmp);
You will find you get an out of memory exception upon executing the code. The reason? .NET does not actually support Format16bppArgb1555 or PixelFormat.Format16bppGrayScale.

0 Comments:
Post a Comment
<< Home