//WriteableBitmap to ARGB
byte array
public static byte[] ToByteArray( this WriteableBitmap bmp)
{
int[] p = bmp.Pixels;
int len = p.Length * 4;
byte[] result = new byte[len]; // ARGB
Buffer.BlockCopy(p, 0, result, 0, len);
return result;
}
//Copy ARGB byte array into WriteableBitmap
public static void FromByteArray( this WriteableBitmap bmp, byte[] buffer)
{
Buffer.BlockCopy(buffer, 0, bmp.Pixels, 0, buffer.Length);
}
public static byte[] ToByteArray( this WriteableBitmap bmp)
{
int[] p = bmp.Pixels;
int len = p.Length * 4;
byte[] result = new byte[len]; // ARGB
Buffer.BlockCopy(p, 0, result, 0, len);
return result;
}
//Copy ARGB byte array into WriteableBitmap
public static void FromByteArray( this WriteableBitmap bmp, byte[] buffer)
{
Buffer.BlockCopy(buffer, 0, bmp.Pixels, 0, buffer.Length);
}