We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello, I am trying to make an animation with pictures, but the program reaches the picture 27 and crashes because its too heavy, is there a way to get around that somehow? here is my code
int numFrames=35;
PImage[] superNova = new PImage [numFrames];
int frame=0;
public void setup(){
background(0);
size(600,600);
frameRate(12);
for(int i=0; i<superNova.length; i++){
String picName= ("star-"+i+".png");
superNova[i]=loadImage(picName);
}
}
public void draw(){
frame=frameCount% numFrames;
println(frame);
image(superNova[frame],0,0,600,600);
}
Answers
How big are these pictures?
318,235 bytes each
The filesize is not really important, the impact on memory is dependant on the number of pixels. But if you don't have huge images, this should not be the problem.
Do you get any error-message? Or does it just freeze?
Can you load and display "star-27.png"?
318 MB ?????
318KB
but compressed file size is unimportant - those 318K could be a million pixels square
What are the dimensions of the images?
You're resizing them to 600x600 anyway, so one approach might be to just do that resizing ahead of time, so the files are smaller and take up less memory.