lexeme
lexeme

Reputation: 2973

ARGB to YUV && Color Spaces in .NET

I noticed that Color struct from System.Drawing represents color in ARGB color space. So there are some questions:

That's all yet)

Thanks!

Upvotes: 1

Views: 3696

Answers (1)

fixagon
fixagon

Reputation: 5566

You cannot directly convert argb to YUV (without loss) cause YUV contains no alpha information.

Depending on what you wanna do with the color after you have these possibilities:

  • you just cut the alpha and discard the transparency

  • you convert to a AYUV which contains also an alpha channel

conversion between color spaces

One possibility to convert a bitmap to a byte[] is to write it in a memorystream and read it bite wise.

MemoryStream stream = new MemoryStream();
bitmap.Save(stream, ImageFormat.Bmp);
byte[] data = stream.ToArray();

Upvotes: 2

Related Questions