title: Redirect binary data from Process.StandardOutput causes corrputed data
body: <p>On top of <a href="https://stackoverflow.com/questions/8978390/passing-command-line-arguments-from-c-sharp-to-a-external-exe/8978450">this</a> problem, I have another. I try to get binary data from a external process, but the data(a image) seems to be corrupted. The screenshot below shows the corruption: The left image was done by executing the program on command line, the right one from code. 
  <img src="https://i.stack.imgur.com/fmq0I.jpg" alt="enter image description here"></p>
  
  <p>My Code so far:</p>
  
  <pre><code>var process = new Process
  {
    StartInfo =
    {
      Arguments = string.Format(@"-display"),
      FileName = configuration.PathToExternalSift,
      RedirectStandardError = true,
      RedirectStandardInput = true,
      RedirectStandardOutput = true,
      UseShellExecute = false,
      CreateNoWindow = true,
    },
    EnableRaisingEvents = true
  };
  
  process.ErrorDataReceived += (ProcessErrorDataReceived);
  
  process.Start();
  process.BeginErrorReadLine();
  
  //Reads in pbm file.
  using (var streamReader = new StreamReader(configuration.Source))
  {
    process.StandardInput.Write(streamReader.ReadToEnd());
    process.StandardInput.Flush();
    process.StandardInput.Close();
  }
  //redirect output to file.
  using (var fileStream = new FileStream(configuration.Destination, FileMode.OpenOrCreate))
  {
    process.StandardOutput.BaseStream.CopyTo(fileStream);
  }
  
  process.WaitForExit();
  </code></pre>
  
  <p>Is this some kind of encoding problem? I used the Stream.CopyTo-Approach as mentioned <a href="https://stackoverflow.com/questions/4143281/capturing-binary-output-from-process-standardoutput">here</a> in order to avoid there problems.</p>