简体   繁体   English

将图像转换为ARGB阵列的最快方法

[英]Fastest way to convert image to ARGB Array

i want to create an application that delete the duplicated photo in some folder so i need to convert an image to an ARGB array [one diemnsion] then compare them . 我想创建一个应用程序,以删除某个文件夹中的重复照片,因此我需要将图像转换为ARGB数组[一个分辨率],然后进行比较。 What is the fastest way to convert an Image to ARGB array? 将图像转换为ARGB阵列的最快方法是什么? or how to improve this code ? 还是如何改进此代码?

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



                    }
                }
              }

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM