Platform
Resources
Pricing
Sign in
Get started
Philippe Deschaseaux
Workspace
Fork
Public
Tools
By
Philippe Deschaseaux
Edited
May 28, 2021
Importers
2 stars
1
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.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
UTIF
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
blob2ArrayBuffer
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
tiffArrayBufferToImageData
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
getTiffImageData
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
imageData
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML