We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi to all! these days i'm working against this little problem...I just can not understand why it does not work as I think. the basic problem is simple and the effect works, except that when I try to save multiple frames of the same image the result does not change, which is very strange because the parameters in the loop of the draw varying! can anyone tell me why!?!? thanks to all!!!
here the code:
PImage img, imgR, imgG, imgB, imgF;
int phase=1, phase2=phase*2, it=0;
String imgName="yolandi_2_-8000000";
String imgType="jpg";
void setup() {
size(850, 1274, P2D);
imageMode(CENTER);
img=loadImage(imgName+"."+imgType);
background(0);
imgR=createImage(img.width, img.height, ARGB);
imgG=createImage(img.width, img.height, ARGB);
imgB=createImage(img.width, img.height, ARGB);
imgF=createImage(img.width, img.height, ARGB);
}
void draw() {
it++;
img.loadPixels();
phase+=1;
phase2=phase*2;
for (int i=0; i<img.width-phase; i++) {
for (int j=0; j<img.height-phase; j++) {
if (i<width && j+(2*phase2)<height) {
imgR.pixels[i+j*img.width]=color(red(img.pixels[i+j*img.width]), 0, 0);
imgG.pixels[i+(j+phase)*img.width+phase]=color(0, green(img.pixels[i+j*img.width]), 0);
imgB.pixels[i+(j+phase2)*img.width+phase2]=color(0, 0, blue(img.pixels[i+j*img.width]));
imgF.pixels[i+j*img.width]=color(
red(imgR.pixels[i+j*img.width]),
green(imgG.pixels[i+j*img.width]),
blue(imgB.pixels[i+j*img.width]));
}
}
}
println(it, phase, phase2);
img.updatePixels();
image(imgF, width/2, height/2);
saveFrame("C:/Users/pietr/Documents/Processing/Sketch/effettiImmagini/imagePhase/frames/"+imgName+"+phase+"+phase+"_"+it+"."+imgType);
if (it>=30) {
println("fine");
exit();
}
}
Answers
Line 8 belongs to setup in your case.
Try calling loadPixels to each of your images.
Call updatePixels to imgF, which is the image you are displaying.
Kf
kfrajer thank you!!
right! he did not change over the other images
really thank you! problem solved and post closed!!!