I try to find in google how to convert imageSource to byte[] - and i can't find the why to do it.
Someone can help here ?
Thanks.
I try to find in google how to convert imageSource to byte[] - and i can't find the why to do it.
Someone can help here ?
Thanks.
If you have a BitmapSource you can use BitmapSource.CopyPixels Method (Array, Int32, Int32)
Or alternativeley, for example if you need a ARGB byte sequence:
var bmp = new WriteableBitmap((BitmapSource)source);
byte[] pixels = bmp.Pixels.SelectMany(p => new byte[]
{
(byte)p,
(byte)(p >> 8),
(byte)(p >> 16),
(byte)(p >> 24)
}).ToArray();