function loadImageAsync(url){
    return new Promise((resolve, reject) => {
        let image = new Image();
        image.onload = function(){
            resolve(image);
        }
        image.onerror = function(){
            reject(new Error('Can not get image at' + url));
        }
        image.src = url;
    })
}