We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello ! I'm trying to code a sort of photobooth - gif recorder. Almost everything is done but I'm stucked on two things…
I'm recording frames then saving them as a gif file with GifMaker, incrementing the file name for each new recording.
1- when the frames are being added to the file, I can't get my screen to display anything, nor a background nor my webcam… is it normal ?
// TODO - CHECK NUMBER OF FILES IN 'IMG' DIRECTORY & INCREMENT FILENAME
gifExport = new GifMaker(this, "img/file"+(nbGif+1)+".gif");
gifExport.setRepeat(0); // make it an "endless" animation
// RECORD FRAMES UNTIL FRAMELIMIT
for (frames=0; frames<frameLimit; frames++) {
gifExport.setDelay(FRAMES_DURATION);
gifExport.addFrame();
println("adding 1 frame");
} // end loop
// STOP RECORDING AND SAVE FILE
if (frames==frameLimit) {
gifExport.finish();
frames=0;
2 - Then I want to get this last file and display it after the recording has ended. All my attempts have been fails and I'm a bit lost. limits of my syntax knowledge… I look at the structure on http://extrapixel.github.io/gif-animation/ and it seems Gif object is not going to work if not instantiated before the draw() ? How can I change the filenames / paths that are instantiated in the setup ? I've tried to change it in the draw but the gif stops to loop, so I think I'm doing something wrong with the library
import gifAnimation.*;
Gif gifLoop;
//...
void setup() {
//…
gifLoop = new Gif(this, "img/file1.gif"); // temporary instanciation
}
void draw() {
image(gifLoop, width/2, height/2, width, height);
gifLoop.play();
}
I can send my (long) sketch if someone want to help / if I'm not being clear. Thanks a lot in advance !
Answers
Ok so a bit more of the sketch (I've made it lighter) Would you know why does the webcam freeze when gif is recording ?
Hello ! I've managed to solve the problems : applet is working ! BUT I always get an OutOfMemoryError any time after a few minutes I've already increased the RAM preferences but it doesn't solve the pb… Can you help me to debug this ? Or is there a way to relaunch automatically so I can make it work for the party tonight ? : )
Thanks a lot
download here