xxxxxxxxxx
const total = 10000;
var points = [];
var img;
function preload() {
img = loadImage('profile.jpg')
}
function setup() {
createCanvas(img.width, img.height);
background(0);
stroke(255);
while(points.length < total){
var x = random(img.width);
var y = random(img.height);
if(random(255) < brightness(img.get(round(x), round(y)))){
points.push({x,y});
}
}
noLoop();
}
function draw() {
points.forEach(p => point(p.x, p.y));
}