xxxxxxxxxx
40
let img;
function preload() {
img = loadImage("masked13.png");//ink2.png");//bw.png");//flow-glitch.png");
}
function setup() {
createCanvas(img.width, img.height);
pixelDensity(1);
let gfx = createGraphics(img.width, img.height);
img.loadPixels();
gfx.loadPixels();
for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
const idx = 4 * pixelDensity() * (int(y) * pixelDensity() * width + int(x));
let r = img.pixels[idx];
let g = img.pixels[idx+1];
let b = img.pixels[idx+2];
if (r == 220 && g == 220 && b == 220) {
r = 255;
g = 255;
b = 255;
}
gfx.pixels[idx] = r;
gfx.pixels[idx+1] = g;
gfx.pixels[idx+2] = b;
gfx.pixels[idx+3] = img.pixels[idx+3];
}
}
gfx.updatePixels();
image(gfx,0,0);
noLoop();
}
function draw() {
// background(220);
}