I'm not sure if this is what you are looking for, but basically you can just do a typed XHR (such as an ArrayBuffer) for the image source (it needs to be cached, so it doesn't need to be done). I assume that you are using an HTML5 compatible browser (either one that supports ArrayBuffer or the type you need). I assume that the document has at least one image with the correct source, see Fiddle for a working demo.
var img = document.querySelector('img'), xhr = new XMLHttpRequest(); xhr.open('GET', img.src, true); xhr.responseType = 'arraybuffer'; xhr.addEventListener('load', handleBuffer, false); xhr.send();
Script example
source share