Bloom.Edit.JpegWarningDialog.HasLotsOfColor C# (CSharp) Method

HasLotsOfColor() private static method

private static HasLotsOfColor ( Bitmap bmp ) : bool
bmp System.Drawing.Bitmap
return bool
        private static bool HasLotsOfColor(Bitmap bmp)
        {
            //what's a good threshold?
            //Higher than one would think, as we want to detect pictures that don't have color just because they were
            //mistakenly made into a jpeg.
            //A  drawing with just 4 colors had 62 once ran through jpeg.
            // Just turning the bloom placeholder flower into jpeg gives us 10 "colors" (different shades of grey)
            const int threshold = 100;
            var sampleLinePercentages = new[] { 20, 50, 70 };
            return
                sampleLinePercentages.Any(sampleLine => GetNumberOfColors(bmp, (int)(bmp.Height * (sampleLine/100.0))) > threshold);
        }