C# 如何从RGB像素阵列保存图像?
最近我了解了如何将图像保存为字节(文本文件中的RGB值),现在我想知道如何从RGB值数组创建完全有效的图像。您可以使用@dasblinkenlight提到的方法:C# 如何从RGB像素阵列保存图像?,c#,image,C#,Image,最近我了解了如何将图像保存为字节(文本文件中的RGB值),现在我想知道如何从RGB值数组创建完全有效的图像。您可以使用@dasblinkenlight提到的方法: int width = 1; // read from file int height = 1; // read from file var bitmap = new Bitmap(width, height, PixelFormat.Canonical); for (int y = 0; y < height; y++)
int width = 1; // read from file
int height = 1; // read from file
var bitmap = new Bitmap(width, height, PixelFormat.Canonical);
for (int y = 0; y < height; y++)
for (int x = 0; x < width; x++)
{
int red = 0; // read from array
int green = 0; // read from array
int blue = 0; // read from array
bitmap.SetPixel(x, y, Color.FromArgb(0, red, green, blue));
}
int width=1;//从文件中读取
整数高度=1;//从文件中读取
var位图=新位图(宽度、高度、像素格式.Canonical);
对于(int y=0;y
您不能使用,读取文件,然后对每个像素调用SetPixel
吗?我没有任何文件,我只有一个像素RGB值的2d数组,接下来该怎么办?(编辑:未看到第二条评论,正在尝试)