Published
Edited
Mar 15, 2021
7 forks
26 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function brightness(data, delta) {
for (let i = 0; i < data.length; i += 4) {
data[i + 0] = data[i + 0] + delta;
data[i + 1] = data[i + 1] + delta;
data[i + 2] = data[i + 2] + delta;
}
}
Insert cell
function multiplication(data, factor) {
for (let i = 0; i < data.length; i += 4) {
data[i + 0] *= factor;
data[i + 1] *= factor;
data[i + 2] *= factor;
}
}
Insert cell
function contrast(data, factor) {
for (let i = 0; i < data.length; i += 4) {
data[i + 0] = (data[i + 0] - 127) * factor + 127;
data[i + 1] = (data[i + 1] - 127) * factor + 127;
data[i + 2] = (data[i + 2] - 127) * factor + 127;
}
}
Insert cell
function gamma(data, power) {
for (let i = 0; i < data.length; i += 4) {
data[i + 0] = 255 * Math.pow(data[i + 0] / 255, power);
data[i + 1] = 255 * Math.pow(data[i + 1] / 255, power);
data[i + 2] = 255 * Math.pow(data[i + 2] / 255, power);
}
}
Insert cell
Insert cell
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