I need to create a 16-bit grayscale image and for each pixel I want to set a different gray level in a range from 0 to 65535 (2 ^ 16 values).
I've tried using:
int height = 1000;
int width = 1280;
Bitmap image16bit = new Bitmap(width, height, PixelFormat.Format16bppGrayScale);
for (int r = 0; r < height; r++)
{
for (int c = 0; c < width; c++)
{
Color nc = Color.FromArgb(255, 10, 20, 30);
image16bit.SetPixel(c, r, nc);
}
}
but does not work.