Hi. I’m new to Processing. Hope someone is able to help me.
In my sketch the pixel sorting work on width, but I I need it to be vertical non horizontal … how?
Thank you.
This is the code:
int mode = 0;
int threshold;
PImage img;
String fileType = “jpg”;
void setup() {
img = loadImage(“Tree.jpg”);
size(1200, 675);
image(img, width, height);
frameRate(60);
}
void draw() {
img.loadPixels();
for (int k=height; k<height*width; k++) {
if (threshold < 150000) {
if (brightness(img.pixels[k]) > threshold) {
img.pixels[k] = color(
int(red(img.pixels[height])),
int(green(img.pixels[height])),
int(blue(img.pixels[height])));
}
else {
img.pixels[height] = color(
int(red(img.pixels[k-1])),
int(green(img.pixels[k-1])),
int(blue(img.pixels[k-1])));
}
threshold = threshold+10;
}
else {
threshold = 0;
}
}
img.updatePixels();
image(img, 0, 0);
}