title: Sending POST request of local image to Microsoft OCR API with Angular
body: <p>I have an Angular app and I want to send a local image from my device to Microsoft OCR API but I have this issue. </p>
  
  <p>In onUpload() function it looks like this</p>
  
  <pre><code>let headers = new HttpHeaders({
        'Ocp-Apim-Subscription-Key': this.myKey,
        'Content-Type': 'application/octet-stream' });
      let options = { headers: headers };
      let data = this.imgURL
      this.http.post("https://southeastasia.api.cognitive.microsoft.com/vision/v1.0/ocr?language=unk&amp;detectOrientation =true",data,options)
      .subscribe(
          (val) =&gt; {
              console.log(val);
          },
          response =&gt; {
              console.log("POST call in error", response);
          },
          () =&gt; {
              console.log("The POST observable is now completed.");
          });
  </code></pre>
  
  <p>When I try to log the 'this.imgURL' it returns "data:image/png;base64,iVBORw0KGg......."</p>
  
  <p>I tested the request <a href="https://southeastasia.dev.cognitive.microsoft.com/docs/services/56f91f2d778daf23d8ec6739/operations/56f91f2e778daf14a499e1fc/console" rel="nofollow noreferrer">here</a> and selected "application/octet-stream", it says the body should be [Binary Image Data]</p>
  
  <p>The request returns '400'</p>
  
  <p>code: "InvalidImageFormat"
  requestId: "1be37150-b8ea-4750-ad06-d12e76b3ac49"
  message: "Input data is not a valid image."</p>