I am facing an issue with Windows Computer Vision API. If I send a request with contentType = application/json and image URL in JSON request body things work fine but on sending a binary image(base 64 encoded) with contentType = application/octet-stream it gives me ImageFormatInvalid in the response.
Any help is much appreciated. Thank you!
Code:
final String binaryData = "data:image/jpeg;base64, /9............
ByteArrayEntity requestEntity = new ByteArrayEntity(binaryData.getBytes(),
ContentType.APPLICATION_OCTET_STREAM);
request.setEntity(requestEntity);
HttpResponse response = httpClient.execute(request);
HttpEntity entity = response.getEntity();
Response: InvalidImageFormat