Please see my comment to the question. As Zoltán Zörgő and I suggested: always use binary streams to send images. Just always.
You did not show how your
ImageToBase46String
and
ToArray
work together, and how you use the stream on the other side, how you deserialize it. Anyway, the only proper way of getting the bytes to send them over the network is this:
System.Text.Encoding encoding =
byte[] bytesToSend = encoding.GetBytes("some string");
What encoding to take? It depends. The most important thing is to use the same on the other end of your network channel. But base64 (why? why?!) uses only ASCII, so it would be save to do
System.Drawing.Image myImage =
byte[] bytesToSend =
System.Text.Encoding.ASCII.GetBytes(
ImageToBase46String(myImage));
—SA