Refactors buildImage to use Promise; don't draw bad images
Merge pull request #4613 from yurydelendik/buildImagePromise

Refactors buildImage to use Promise; don't draw bad images