Published
Edited
Dec 23, 2019
20 stars
Also listed in…
Color
Insert cell
Insert cell
Insert cell
Insert cell
im = d3
.image(await FileAttachment("heidi-couverture-livre.jpg").url(), {
crossOrigin: "anonymous"
})
.then(d => ((d.style = "max-width: 200px"), d))
Insert cell
// this object shows the structure needed by Jochen’s implementation
grid = function(channel) {
const context = DOM.context2d(w, h, 1);
context.drawImage(im, 0, 0, w, h);
const data = context.getImageData(0, 0, w, h);
return {
width: w,
height: h,
pos_at_index: function(idx) {
return [idx % w, Math.floor(idx / w)];
},
values: data.data
.filter((_, i) => i % 4 === channel)
.map(d => (!inverse ? 255 - d : d))
};
}
Insert cell
r = grid(0)
Insert cell
g = grid(1)
Insert cell
b = grid(2)
Insert cell
import { stipples_new as stipples_r } with {
r as himmelblau_grid
} from "b333da9462d0762b" // a variant of "@grtlr/stippling-of-2d-scalar-fields" using d3-delaunay instead of d3-voronoi
Insert cell
import { stipples_new as stipples_g } with {
g as himmelblau_grid
} from "b333da9462d0762b" // a variant of "@grtlr/stippling-of-2d-scalar-fields" using d3-delaunay instead of d3-voronoi
Insert cell
import { stipples_new as stipples_b } with {
b as himmelblau_grid
} from "b333da9462d0762b" // a variant of "@grtlr/stippling-of-2d-scalar-fields" using d3-delaunay instead of d3-voronoi
Insert cell
w = Math.min(width)
Insert cell
h = ((im.height / im.width) * w) | 0
Insert cell
d3 = require("d3@5")
Insert cell
import { checkbox } from "@jashkenas/inputs"
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more