xxxxxxxxxx
36
function setup() {
let canvas = createCanvas(windowWidth, windowHeight);
canvas.drop(gotFile);
}
function draw() {
background(127);
fill(255);
noStroke();
textSize(24);
textAlign(CENTER);
text('Drag an image file onto the canvas.', width/2, height/2);
noLoop();
}
function gotFile(file) {
// If it's an image file
if (file.type === 'image') {
// Create an image DOM element but don't show it
var img = createImg(file.data).hide();
} else {
println('Not an image file!');
}
}
function processImage(img){
let colors = [];
img.loadPixels();
for(let i = 0; i < img.width; i++) {
for(let j = 0; j < img.height; j++) {
}
}
}