We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › Animated GIF library for Processing
Pages: 1 2 
Animated GIF library for Processing (Read 16953 times)
Animated GIF library for Processing
Jan 3rd, 2008, 3:40pm
 
Recovering from a recent Newyear hangover and some requests in the forum lately motivated me to stitch together a library for importing/displaying animated GIFs Wink
GifAnimation let's you extract animation frames into a PImage[] array or plays animations just like Movies.

The hard part was done by Kevin Weiner who made this great working java GifDecoder class:
http://www.java2s.com/Code/Java/2D-Graphics-GUI/GiffileEncoder.htm

So I wrapped a processing library around the decoder and added some playback controls (loop/noLoop,play,pause,stop,jump). GifAnimation supports transparent GIFs and optimized animations (the 'progressive' type) and correctly handles frame delays set in the GIF file.

Download & Docs here:
http://www.extrapixel.ch/2008/01/03/gifanimation-processing-library/
http://www.extrapixel.ch/processing/gifAnimation/

Online example:
http://www.extrapixel.ch/processing/gifAnimation/applet/
Re: Animated GIF library for Processing
Reply #1 - Jan 3rd, 2008, 10:47pm
 
Thankyou, I've been working on a project for a while that needs little animated people, this will be perfect!
Import & export animated GIFs
Reply #2 - Jan 8th, 2008, 11:51am
 
I just updated the gifAnimation library. It has a GifMaker class now, so it lets you create and export GIF animations.

Download, Docs & Examples here:

http://www.extrapixel.ch/processing/gifAnimation/
Re: Animated GIF library for Processing
Reply #3 - Jan 17th, 2008, 12:22am
 
Hey this library is very nice! Two additional things that I think would be really useful would be for the Gif object to have an "isPlaying" property and a method that returns what the current frame is. Keep up the good work!
Re: Animated GIF library for Processing
Reply #4 - Jan 18th, 2008, 11:50pm
 
good idea, thank you! i put a new version online and added isPlaying(), isLooping(), currentFrame(), and some others.
Re: Animated GIF library for Processing
Reply #5 - Feb 14th, 2008, 1:36pm
 
great library! thanks a lot!

but it seems to me that the transparency is not working in opengl. any ideas why this could be?

Re: Animated GIF library for Processing
Reply #6 - Feb 15th, 2008, 12:06am
 
hi. i just re-checked it with the opengl-renderer on mac & win, and transparency worked as expected. can you post the code or upload the sketch somewhere (including the gif-files)?
Re: Animated GIF library for Processing
Reply #7 - Feb 18th, 2008, 6:03pm
 
hej,

this is my code, it only appears on some instances and seems to be related to 3 dimensional movement i think.

import processing.opengl.*;
import gifAnimation.*;
PImage[] animation;

Gif loopingGif;
int counter;
void setup() {
 size(800, 600,OPENGL);
 loopingGif = new Gif(this, "http://www.contact.net/maximel/diamond_lg_clr.gif");
 loopingGif.loop();
 background(0);
}
void draw() {
//if (frameCount%300==0) background(0);
 counter=(counter+1)%300;
 
 for (int i=0; i<10; i++){
image(loopingGif,400,300);
translate(sin(counter*.03)*100,sin(counter*.2)*200,sin(counter*.1)*10);
 }
}
Re: Animated GIF library for Processing
Reply #8 - Feb 18th, 2008, 6:38pm
 
ok, this is a problem in processing itself and has nothing to do with the GIF library. You could load a transparent png with loadImage()... I guess exactly the same woud happen. I think it has something to do with depth sorting, don't know it exactly though.
Re: Animated GIF library for Processing
Reply #9 - Jul 22nd, 2008, 10:53am
 
yes. its a OPENGL/ALPHA/Depthsorting issue. see here:
http://dev.processing.org/bugs/show_bug.cgi?id=176
Re: Animated GIF library for Processing
Reply #10 - Sep 13th, 2008, 2:23am
 
Hi there
Really neat library ^^
I have a question, though : where can I find the delay for each frame ? I have my PImage array, so that I can process  each frame one after another, but I'd need the delays to play it back at the right speed without losing too much "power" ^^
You can see how I use the library right here :
http://melka.one.free.fr/blog/?p=131

Thanks
Re: Animated GIF library for Processing
Reply #11 - Nov 24th, 2008, 7:16pm
 
Hello,

I am using the nonLoopingGif.

I have just made my gif longer, 20 frames in total, and it now plays very quickly.
This looses the effect of the gif. Is there a reason why this gif would play so fast? I plan to add more frames to the gif also.

It plays at regular speed in other programmes. Other gifs with less frames play at correct speed.  


Thanks a Million!!
Aoife
Re: Animated GIF library for Processing
Reply #12 - Nov 29th, 2008, 5:25am
 
hi,

you can use setDelay(milliseconds) to set the time for how long the most recently added frame will be shown. also check out the docs for setDelay(). post your code if it's still not working...
Re: Animated GIF library for Processing
Reply #13 - Jan 15th, 2009, 12:12am
 
I'm new, sorry if this is a stupid question -
I can't get this library to work for Processing 1.0.1
  ('you might be missing a library') - and it is placed in my 'libraries' folder in the sketch folder.

I CAN get it to work for 0135.

has it just not been updated yet?

much appreciated!

Re: Animated GIF library for Processing
Reply #14 - Jan 15th, 2009, 12:18am
 
Works for me... (WinXP Pro)
The jar is located at <sketchbook path>\libraries\gifAnimation\library\gifAnimation.jar
Pages: 1 2