Public
Edited
Apr 8
Insert cell
Insert cell
import {transformarImagen, histogramaImagen} from "@srsergiorodriguez/manipulacion-imagenes"
Insert cell
callback = (rgb) => {
// Tomar los canales rgb de cada pixel
const [r, g, b] = rgb;

// Retornar nuevos valores rgb
return [r, g, b]
}
Insert cell
transformarImagen(nekomomo, callback)
Insert cell
histogramaImagen(nekomomo)
Insert cell
Insert cell
bitcrush = (rgb, q = 8) => {
const [r, g, b] = rgb;
const scale = Math.pow(2, q);
const nr = (Math.floor((r/255) * scale) / scale) * 255;
const ng = (Math.floor((g/255) * scale) / scale) * 255;
const nb = (Math.floor((b/255) * scale) / scale) * 255;
return [nr, ng, nb]
}
Insert cell
guatavita = FileAttachment("guatavita.jpg").url()
Insert cell
nekomomo = FileAttachment("nekomomo.jpg").url()
Insert cell
// const promedio = (r + g + b) / 3;
// const umbral = 127;
// const stencil = promedio < umbral ? 0 : 255;

// const promedioInvertido = 255 - promedio;
// const stencilInvertido = 255 - stencil;

// const probabilidad = 0.4;
// const cambiarPixel = Math.random() < probabilidad;

// const nuevoR = cambiarPixel ? Math.floor(Math.random() * 255) : r;
// const nuevoG = cambiarPixel ? Math.floor(Math.random() * 255) : g;
// const nuevoB = cambiarPixel ? Math.floor(Math.random() * 255) : b;
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