Every now and then, the hiddenImage.onload function will fail, because the width and height of the hiddenImage are zero. The IE will throw an IndexSizeError in line 161, when it tries to get the image data. Safari fails silently. The reason for this is, that only the complete property is evaluated to consider the manual firing of the onload callback. But it can happen sometimes, that the complete property is true, but width and height are not calculated yet. So I added an extra test for the naturalWidth of the image. See also here: http://stackoverflow.com/questions/1977871/check-if-an-image-is-loaded-no-errors-in-javascript#answer-1977898
The crossorigin settings are currently breaking image tests in Firefox and Safari when the images are not cross-domain (e.g. images specified as base64 strings, or using relative pathing).
This change enables CORS on the image if and only if the image is 1) specified using absolute pathing with the HTTP or HTTPS protocol and 2) the image is from a different domain than resemble.js is being run on.