Instead of converting the WriteableBitmap to a byte array you should encode it as a JPEG or an other image format and send that as base64 string. Then on the JScript side you need to decode the base64 string and you have a JPEG file format.