xxxxxxxxxx
var img;
var emoji_bright, emoji_dark;
function preload() {
img = loadImage("Webcam.png");
}
function setup() {
createCanvas(1920, 1080);
noLoop();
}
function draw() {
background(50);
//image(img, 0, 0);
// Pixel in Speicher laden
img.loadPixels();
// Zeilen
for (var y = 0; y < img.height; y += 5) {
// Spalten
for (var x = 0; x < img.width; x += 5) {
var pixel = red(img.get(x, y));
rectMode(CENTER);
noStroke();
// Fairey Obama
if (pixel < 60)
fill(13, 59, 102);
else if (pixel >= 60 && pixel < 120)
fill(250, 240, 202);
else if (pixel >= 120 && pixel < 180)
fill(244, 211, 94);
else if (pixel >= 180)
fill(238, 150, 75);
rect(x, y, 5, 5);
}
}
}