コード例 #1
0
        /// <summary>
        /// The image compare.
        /// </summary>
        /// <param name="firstImagePath">The first image path.</param>
        /// <param name="secondImagePath">The second image path.</param>
        /// <returns>The <see cref="bool" />.</returns>
        private static bool ImageCompare(string firstImagePath, string secondImagePath)
        {
            simpleCompare = new BitmapCompare();
            double sim;

            using (var comImage = new Bitmap(firstImagePath))
                using (
                    var fileBitmap =
                        new Bitmap(
                            ThumbnailGenerator.GetThumbnailFromFile(secondImagePath, comImage.Width, comImage.Height, true, true)))
                {
                    sim = simpleCompare.GetSimilarity(comImage, fileBitmap);
                }

            return(Math.Round(sim, 3) > 0.75);
        }