1

我想创建一个删除某个文件夹中重复照片的应用程序,所以我需要将图像转换为 ARGB 数组 [one diemnsion] 然后比较它们。将图像转换为 ARGB 数组的最快方法是什么?或者如何改进这段代码?

 Image img;
 using (FileStream stream = new FileStream(imagefile, FileMode.Open))
            {
                img = Image.FromStream(stream);
            }

 using (Bitmap bmp = new Bitmap(img))
            {
                int[] argb = new int[bmp.Width * bmp.Height];
                for (int x = 0; x < bmp.Width; x++)
                {

                    for (int y = 0; y < bmp.Height; y++)
                    {

                        Color pxl = bmp.GetPixel(x, y);

                        argb[x * y] = pxl.ToArgb();



                    }
                }
              }
4

1 回答 1

0

将图像转换为位图后,所有像素的半透明值为 255...

于 2019-02-19T23:06:44.600 回答