Microsoft Cognitive Services Emotion API. Error: 'Image size is too small or too big.'


I have noticed a rather strange error with the Emotion API from the Cognitive Services suite.

Everything works just fine as long as I send it URL's. When sending it image attachments. I receive this JSON error: { error: { code: 'InvalidImageSize', message: 'Image size is too small or too big.' } }

Sending it smaller or larger versions does not help. Send a URL of the same image, and suddenly it works fine again.

I stream the attachment to the API service in the exact same way I do for another Cognitive Services API, namely Computer Vision. And that works great with streamed attachments.

The code is on GitHub: <a href="https://github.com/sebsylvester/botbuilder-mcs" rel="nofollow">https://github.com/sebsylvester/botbuilder-mcs</a>

I know the APIs are still in preview, but this is still a weird issue.


Unfortunately, the Emotion and Face APIs do not support chunked transfers, as noted <a href="https://github.com/felixrieseberg/project-oxford/issues/15" rel="nofollow">here</a>. The 'workaround' is to load the image bits synchronously prior to making the web request. The code <a href="https://github.com/felixrieseberg/project-oxford/blob/master/src/face.js#L75" rel="nofollow">snippet</a> from that project is thus:

function _postImageSync(url, image, options) { return new _Promise(function (resolve, reject) { request.post({ uri: host + rootPath + url, headers: { 'Ocp-Apim-Subscription-Key': key, 'Content-Type': 'application/octet-stream' }, qs: options, body: fs.readFileSync(image) }, (error, response) => { response.body = JSON.parse(response.body); _return(error, response, resolve, reject); }); }); }


  • TextBox controls are not Working with Export To PDF(iTextSharp)
  • How to update the UI immediately when a new record is added? Related to ember-cli-pagination
  • How to Cache Images Dynamically-Generated with PHP?
  • Could be Text orientation of JTextArea changed by keyboard shortcut?
  • passing parameter to server in ExtJs
  • SOAP with Attachment / MIME content
  • Xcode duplicated devices bug
  • Get or convert Week of year to ISO week
  • WebApp in AppServices vs CloudService
  • Is it possible to “shrink” a PdfPtable?
  • Fixed Background Works in Chrome but Not Firefox?
  • How do i find all references to a user control
  • Android application not restoring state when installed from .apk, works fine from eclipse
  • retrieving data from url in iphone
  • Unzip archive in .Net CORE 1.0
  • Efficient & Pythonic way of finding all possible sublists of a list in given range and the minim
  • Action Pack components in Rails
  • Streaming screenshots over WebRTC as a video stream from iOS
  • Retaining data after updating application
  • Python cosine function precision [duplicate]
  • HttpClient: disabling chunked encoding
  • How to handle elastic beanstalk deployment so it uploads only changed files
  • Filter strings with regex before casting to numeric
  • Trying to get the char code of ENTER key
  • 550 Access denied - Invalid HELO name
  • Specifying Castle WCF Integration Facility Endpoint Behavior per Endpoint
  • How to define custom class, title, and target in Link Browser for content elements and the new rte_c
  • Play WS (2.2.1): post/put large request
  • Bad request using file_get_contents for PUT request in PHP
  • Atlas images wrong size on iPad iOS 9
  • Ajax Loaded meta Tags
  • Debugging ASP.NET on a built-in web server suddenly stops
  • C# - Is there a limit to the size of an httpWebRequest stream?
  • Is there a amazon webstore API for customers?
  • Updating server-side rendering client-side
  • Calling of Constructors in a Java
  • How to pass list parameters for each object using Spring MVC?
  • Circular dependency while pushing http interceptor
  • Angular 2 constructor injection vs direct access
  • sending mail using smtp is too slow