Published
Edited
Apr 29, 2021
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
finalImage = {
const w = imageWidth / 20;
const h = imageHeight / 20;
const context = DOM.context2d(w, h);
// Draw a black box before the file is loaded
context.fillStyle = "black";
context.fillRect(0, 0, w, h);
FileAttachment("remi-walle-Ui3bOgnjtl0-unsplash.jpg").image().then(image => {
// Once the file is loaded, draw it into the existing canvas
context.drawImage(image, 0, 0, w, h);
// You might need to update your webgl rendering
update(context);
})
return context.canvas;
}
Insert cell
update = function() {
// file uploaded
}
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more