Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

"OutOfMemoryError" When Loading Animated GIF

$
0
0

Hi,

I tried to load a series of gif files using the gifAnimation library and encountered "OutOfMemoryError". I have tried increasing the memory settings but encountered the same error.

The problem occurs at Line 15.

This is how the code looks like:

import gifAnimation.*;

Gif scene0, scene1A, scene1B, scene2;

int cplay = 0; //Current gif playing.

void setup() {
  size(1920, 1080);
  background(0);
  imageMode(CENTER);

  scene0 = new Gif(this, "Scene 0.gif");
  scene1A = new Gif(this, "Scene 1 - A.gif");
  scene1B = new Gif(this, "Scene 1 - B.gif");
  scene2 = new Gif(this, "Scene 2.gif");

  scene0.play()
  cplay = 0;

}

void draw() {

  if(cplay == 0){
     image(scene0, width/2, height/2 - 150);
  }
  else if (cplay == 1){ 
    image(scene1A, width/2, height/2);
    image(scene1B, width/2, height/2);
  }
  else {
     image(scene2, width/2, height/2);
  }

}

void mouseReleased(){

  cplay = cplay + 1;

  scene0.stop();
  scene1A.stop();
  scene1B.stop();

   if(cplay == 0){
    scene0.play();
  }
  else if (cplay == 1){
     scene1A.play();
     scene1B.play();
  }
  else {
    scene2.play();
  }
}

Regards.


Viewing all articles
Browse latest Browse all 2896

Trending Articles