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