xxxxxxxxxx
52
let img;
let grid_size = 1;
let row = [];
function preload() {
img = loadImage('https://picsum.photos/200');
}
function setup() {
createCanvas(img.width, img.height);
//let img2 = createImage();
img.loadPixels();
for (let y = 0; y < img.height; y ++) {
for (let x = 0; x < img.width; x += grid_size) {
let pixel_colour = img.get(x, y);
pixel_colour = color(pixel_colour);
if (brightness(pixel_colour) > 70){
//fill(pixel_colour);
//stroke(pixel_colour);
//circle(x, y, grid_size);
}
if(row[x] == null){
row[x] = pixel_colour;
}
else{
row[x] = lerpColor(row[x], pixel_colour, 0.1);
}
//fill(row[x]);
//stroke(row[x]);
// circle(x, y, grid_size);
img.set(x, y, row[x]);
img.updatePixels();
}
}
img.updatePixels();
image(img, 0, 0);
}
function draw() {
}