Hi,
I'm actually stuck with a simple thing but i'm not into the good context to get it working. I've actually 100 images generated randomly by a sketch.
I've stored them in a array of PImage's and load each image pixels in memory.
I want to get each lines' pixels of each images and copy them into the final image.
So the first line of image 1 will be the first line of the final image, the second line of image 2 will be the second line of the final image and the like until the widht of the final image.
Here's my try so far but my loop algorithm isn't good.
Quote:
PImage[] images = new PImage[100];
PImage output = createImage(300, 100, ARGB);
size(300, 100);
background(0);
//load all the images (from 0001 to 0100) in the images array
for (int i=0; i<=99; i++){
if (i<9)
{
images[i] = loadImage("pattern-000"+ (i+1) +".png");
println("pattern-000"+ (i+1) +".png");
}
else if (i <99)
{
images[i] = loadImage("pattern-00"+ (i+1) +".png");
println("pattern-00"+ (i+1) +".png");
}
else if (i == 99) {
images[i] = loadImage("pattern-0"+ (i+1) +".png");
println("pattern-0"+ (i+1) +".png");
}
images[i].loadPixels(); //load all images pixels in memory.
for (int j=0; j< (width-1); j++){
for (int k=1; k<height; k++){
output.pixels[j*k] = images[i].pixels[j*k];
}
}
/*
for (int k=0; k<width; k++){
for (int j=0; j<100 ;j++){
output.pixels[j] = images[i].pixels[k];
//translate(0, j);
//output.pixels[j] = images[i].pixels[j];
}
}
*/
}
image(output, 0, 0);
I'm sorry, i know that's very simple, but sometimes my brain seems like not working anymore.
Regards.