automatisation of changing photo-filter
in
Programming Questions
•
3 years ago
Hi there!
I'm relativly new to processing and quit amazed by it, and this is my first post.
So I wonder if there's a solution to my problem:
I want to create a pattern, with colors based on a png-image.I need 199+ of these, but each should be slightly different with one parameter constantly growing. I managed this with the code attached (no experience with programming, therefore a bit a mess, but it works...)
now the problem is, that I need each iteration to take a diffferent png-image as source for the colors. Let's say I have a folder with images named l1.png, l2.png, l3.png...
how could I replace "00_allflags.png" with one of these images?
I tried hard, but didn't manage to get there, hope you can help me out! many thanks!
int x=1;
void draw()
{
if(x<5000){
PImage img;
img = loadImage("00_allflags.png");
size(2000, 2000);
background(255);
smooth();
noStroke();
for (int i = x; i > 1; i--){
float diameter = height*i/x;
float angs = random(360);
float x = random(5); //angle
float y=random(20); //void
float d = random(5, 50); //thickness
float h = 0; //randomness
float e = random(-h, h);
float f = random(-h, h);
int u = int(random(img.width));
int v = int(random(img.height));
int loc = u + v*img.width;
loadPixels();
float m = red(img.pixels[loc]);
float g = green(img.pixels[loc]);
float c = blue(img.pixels[loc]);
fill(m,g,c);
arc(width/2+e, height/2+f, diameter, diameter, angs, angs+x);
}
x= x+1000;
}
else{
noLoop();
}
saveFrame();
}
1
