Public
Edited
May 28, 2021
Importers
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
blob2ArrayBuffer = blob =>
new Promise((resolve, reject) => {
var reader = new FileReader();
reader.addEventListener("loadend", () => resolve(reader.result));
reader.readAsArrayBuffer(blob);
})
Insert cell
Insert cell
tiffArrayBufferToImageData = buffer => {
const ifds = UTIF.decode(buffer);
UTIF.decodeImages(buffer, ifds);
const timage = ifds[0];
const array = new Uint8ClampedArray(UTIF.toRGBA8(timage));
return new ImageData(array, timage.width, timage.height);
}
Insert cell
Insert cell
getTiffImageData = async image => blob2ArrayBuffer(image).then(tiffArrayBufferToImageData)
Insert cell
Insert cell
imageData = FileAttachment("Perspective_view_of_Korolev_crater.tif")
.blob()
.then(getTiffImageData)
Insert cell
Insert cell
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