在图片框中显示三个字节数组(display three array of byte in picture box)

我有三个字节存储三种颜色(红色,绿色,蓝色),如何在c#中的图片框中显示这个数组,文件类型是图像的位图文件

byte[,] R=new byte[width, height]; byte[,] G=new byte[width, height]; byte[,] B=new byte[width, height];

这三个数组都不是空的,每个数组中都有数据存储。

I have three array of byte stored three colors (Red, Green, Blue), how can I display this array in picture box in c#, and type of file is bitmap file for image

byte[,] R=new byte[width, height]; byte[,] G=new byte[width, height]; byte[,] B=new byte[width, height];

these three array are not empty ,there are data stored in each array.

最满意答案

你意思是:

Bitmap bmp = new Bitmap(width,height); for(int i=0;i<width;i++) for(int j=0;j<height;j++) { SetPixel(i,j,Color.FromArgb(R[i,j],G[i,j],B[i,j])); } picturebox.image=bmp;

You mean:

Bitmap bmp = new Bitmap(width,height); for(int i=0;i<width;i++) for(int j=0;j<height;j++) { SetPixel(i,j,Color.FromArgb(R[i,j],G[i,j],B[i,j])); } picturebox.image=bmp;在图片框中显示三个字节数组(display three array of byte in picture box)

我有三个字节存储三种颜色(红色,绿色,蓝色),如何在c#中的图片框中显示这个数组,文件类型是图像的位图文件

byte[,] R=new byte[width, height]; byte[,] G=new byte[width, height]; byte[,] B=new byte[width, height];

这三个数组都不是空的,每个数组中都有数据存储。

I have three array of byte stored three colors (Red, Green, Blue), how can I display this array in picture box in c#, and type of file is bitmap file for image

byte[,] R=new byte[width, height]; byte[,] G=new byte[width, height]; byte[,] B=new byte[width, height];

these three array are not empty ,there are data stored in each array.

最满意答案

你意思是:

Bitmap bmp = new Bitmap(width,height); for(int i=0;i<width;i++) for(int j=0;j<height;j++) { SetPixel(i,j,Color.FromArgb(R[i,j],G[i,j],B[i,j])); } picturebox.image=bmp;

You mean:

Bitmap bmp = new Bitmap(width,height); for(int i=0;i<width;i++) for(int j=0;j<height;j++) { SetPixel(i,j,Color.FromArgb(R[i,j],G[i,j],B[i,j])); } picturebox.image=bmp;