[英]Fastest way to convert image to ARGB Array
我想創建一個應用程序,以刪除某個文件夾中的重復照片,因此我需要將圖像轉換為ARGB數組[一個分辨率],然后進行比較。 將圖像轉換為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();
}
}
}
將圖像轉換為位圖后,所有像素的半透明性值為255 ...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.