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 . What is the fastest way to convert an Image to ARGB array? 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 ...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.