开发者

Float array to Image

I have a float array representing a grayscale picture that I want to convert to an image in C#. How do I g开发者_开发百科o about doing so?


Bitmap newBitmap = new Bitmap(original.Width, original.Height);

        for (int j = 0; j < original.Height; j++)
        {
            for (int i = 0; i < original.Width; i++)
            {
                Color newColor = Color.FromArgb((int)grayScale[i + j * original.Width], (int)grayScale[i + j * original.Width], (int)grayScale[i + j * original.Width]);

                newBitmap.SetPixel(i, j, newColor);
            }
        }

        Image img = (Image)newBitmap;


Microsoft forum for converting Example in codeproject

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜