/// <summary>
 /// Iterate through the list of BitmapStoreData and return true if the given image is equal to one of them
 /// </summary>
 /// <param name="imgList"></param>
 /// <param name="img"></param>
 /// <returns></returns>
 public static bool SamePictures(List <BitmapStoreData> imgList, BitmapStoreData img)
 {
     foreach (BitmapStoreData imgCompare in imgList)
     {
         if (SamePictures(img, imgCompare))
         {
             return(true);
         }
     }
     return(false);
 }
        /// <summary>
        /// Return a list of BitmapStoreData objects to iterate through them later
        /// </summary>
        /// <param name="listFileName"></param>
        /// <returns></returns>
        public static List <BitmapStoreData> GetListBitmapStoreData(List <string> listFileName)
        {
            List <BitmapStoreData> bitmapList = new List <BitmapStoreData>();

            foreach (string fileName in listFileName)
            {
                Bitmap img = ImageUtilsShared.CreateBitmap(fileName);
                if (img != null)
                {
                    BitmapStoreData bmp = new BitmapStoreData(img);
                    if (bmp.BData != null)
                    {
                        bitmapList.Add(bmp);
                    }
                }
            }
            return(bitmapList);
        }
        /// <summary>
        /// Compare 2 BitmapStoreData and return true if the images are the same
        /// </summary>
        /// <param name="img1"></param>
        /// <param name="img2"></param>
        /// <returns></returns>
        public static bool SamePictures(BitmapStoreData img1, BitmapStoreData img2)
        {
            if (!AreSameSize(img1.BData, img2.BData)) // Not the same size
            {
                return(false);
            }

            byte[] data1 = img1.Data;
            byte[] data2 = img2.Data;
            for (int i = 0; i < img1.Size; i += img1.BitsPerPixel / 8)
            {
                if (data1[i] != data2[i] || data1[i + 1] != data2[i + 1] ||
                    data1[i + 2] != data2[i + 2] || data1[i + 3] != data2[i + 3])    // Pixels are different
                {
                    return(false);
                }
            }
            return(true);
        }