I am using Processing 1.2.1 and try to create a gif-animation using the webcam as the input source. When using the gifAnimation-Library, I always get a NullPointerException.
Since I get an Exception even when I try to run the Example-Code, I guess the library (or Processing 1.2.1) contains a bug. Here is the sourcecode I am trying to run (I just used the examples):
- import processing.video.*;
- import gifAnimation.*;
- Capture myCapture;
- GifMaker gifExport;
- void setup()
- {
- size(200, 200);
- // The name of the capture device is dependent those
- // plugged into the computer. To get a list of the
- // choices, uncomment the following line
- println(Capture.list());
- // And to specify the camera, replace "Camera Name"
- // in the next line with one from Capture.list()
- // myCapture = new Capture(this, width, height, "Camera Name", 30);
- // This code will try to use the last device used
- // by a QuickTime program
- myCapture = new Capture(this, width, height, "USB Video Class Video", 10);
- GifMaker gifExport = new GifMaker(this, "foo.gif");
- gifExport.setRepeat(0);
- }
- void captureEvent(Capture myCapture) {
- myCapture.read();
- }
- void draw() {
- image(myCapture, 0, 0);
- if (keyPressed == true) {
- gifExport.finish();
- myCapture.stop();
- }
- else {
- gifExport.addFrame();
- }
- }
Do you have any hints for a workaround? Maybe a better Gif-Lib?
1