Search code examples
c#colorsargb

How to convert a color to Argb in C#


this is my situation: I'm reading a color with GetPixel, and now i have to convert this to Argb using C#

the string would have to look like this: 16777215 (this is a white color)

I hope you can help me!

Note: this is not a "regular" problem and cannot be found easily on the internet.


Solution

  • If I understood your question correctly, you want to get an ARGB representation of a Color value, correct?

    Color x = getPixel(...); //As specified in your original post
    int argb = x.ToArgb();
    

    Best regards Andreas