c#创建16位灰度

时间:2014-05-08 09:38:33

标签: c# image grayscale

我需要创建一个16位灰度图像,对于每个像素,我想设置一个不同的灰度级,范围从0到65535(2 ^ 16个值)。

我尝试过使用:

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

但不起作用。

0 个答案:

没有答案
相关问题