My goal: convert each pixel of an image to hexadecimal code where every 6 symbols means color and save such code in a string. Then I would be able to detect, which color dominates in the picture.
How can I convert picture to 6 symbols hex code (where for example 000000 is black and FFFFFF is white)?
I tried this C# code:
using System.IO;
using System.Runtime.Remoting.Metadata.W3cXsd2001;
...
var str = new SoapHexBinary(File.ReadAllBytes("test.png")).ToString();
Console.WriteLine("str: {0}", str);
It gives we a string (I am pasting just a snip):
89504E470D0A1A0A0000000D4948445200000026000000210806000000B538D916000000017352474200AECE1CE90000000467414D410000B18F0BFC610
I want to interpret every 6 symbols as a color code but for example #89504E is dark pink and my test picture looks just like that:
How can I convert picture to 6 digits hex color code?