So I've spent all day trying to figure out how to save the results of the code below as an image.. I feel it's time to post a question and receive the probably obvious and simple answer.
The code is not mine, I forget who posted it and have no browser history to find out who it was. But I got it off this forum.
Anyway here it is..
PImage img;
void setup() {
img = loadImage("image.jpg");
size(img.width,img.height);
}
void draw() {
background(255);
loadPixels();
for (int y = 0; y<height; y+=1 ) {
for (int x = 0; x<width; x+=1) {
int loc = x + y*img.width;
float r = red (img.pixels[loc]);
float g = green (img.pixels[loc]);
float b = blue (img.pixels[loc]);
float av = ((r+b+g)/1.0);
pushMatrix();
translate(x,y);
stroke(r,g,b);
if (r > 50 && r < 150) {
line(0,0,(av-10)/1,0);}
popMatrix();
}
}
println("done");
noLoop();
}
So any ideas as to what code is needed to save the results?
I'd like to create a bundle of pixel sorting pde's. I've become fascinated by the whole concept of it and really like the way processing is used to do it, compared to very raw and unstable data bending techniques.
If anyone has a pixel sorting pde they would like to share pelase post it below!