Saturday, 14 September 2013

Blob object in HTML5

Blob object in HTML5

After reading this question, I have finally turned a canvas into a Blob
object using the following code:
function dataURItoBlob(dataURI) {
var binary = atob(dataURI.split(',')[1]);
var array = [];
for(var i = 0; i < binary.length; i++) {
array.push(binary.charCodeAt(i));
}
return new Blob([new Uint8Array(array)], {type: 'image/jpeg'});
}
(From Vava720)
How would I instantiate the blob to catch the value coming from the return
statement? I am trying to use this so my canvases would work with
Resemble.js, which only accepts files as input. Would I be able to use
their apis like this:
resemble(Blob_name).compareTo(Blob_name2).onComplete(function(data){
if(data.misMatchPercentage == 0){
alert("hello");
}
});
Any help is appreciated. Thanks in advance!

No comments:

Post a Comment