-
-
Notifications
You must be signed in to change notification settings - Fork 438
Closed
Labels
Milestone
Description
How to reproduce the bug:
using (MagickImage Image = new MagickImage(ImageBlob))
{
Dictionary<IMagickColor<ushort>, int> Histogram = Image.Histogram();
IMagickColor<ushort> DominantColor = Histogram.Aggregate((x, y) => x.Value > y.Value ? x : y).Key;
Console.WriteLine(string.Format("#{0}{1}{2}", DominantColor.R.ToString("X2"), DominantColor.G.ToString("X2"), DominantColor.B.ToString("X2")));
}
The output will be #B9B9B2B27E7E while it should be #B9B27E.
Adding .Substring(2) after ToString("X2") solves the problem.
The same problem also occurs using:
Console.WriteLine("#" + DominantColor.ToShortString());
therefore I think the problem is on the Histogram method.
Magick.NET Q16 AnyCPU v7.22.2.2