generate "data:" images in JavaScript