21 February 2012

How To Create GIF Animation In Linux


If we are a web developer, we often need some attractive stuffs to be included in our web project. Common stuff of it is flash or gif animation. But, because flash animation need flash plugin to be able to be played in browser, and also because of the filesize, flash animation would make our website heavier –and we all know, heavy-to-load web page is ultimately annoying.

The better solution is to use gif animation. It is extremely light and ultimately flexible to be included in web page. In Windows, we could make gif animation easily using Image Ready. And how about Linux? Once again, do not worry! We've already had the way. The app we need to create gif animation in Linux is gifsicle. It is a command-line app, but don't be afraid, it ain't horrible but very simple and easy.

Here it is the steps :

1. Edit our image to be multiple frames, and save them as gif. We could do this using GIMP (which has capability to save into gif). Or we could do this using other simple image editor like Kolourpaint and save them as jpeg, and then we just need to convert them as gif.

2. If we're not yet have gif images, we have to convert them into gif using phatch. I've posted the way to convert multiple image in Linux HERE.

3. We have to arrange our images as frames by renaming them to be sequence (e.g. : 0001.gif, 0002.gif, 0003.gif and so on).

4. Now, we just need to execute gifsicle command like this :

gifsicle --delay=100 --loop *.gif > anim.gif

(delay in a centisecond = 1/100 second. 100 = 1 second)

5. And yes, we've done creating a gif animation using Linux and FOSS app !

Installation

Gifsicle is popular, we can install it through the repo of our distro we use. In Debian and Ubuntu, it is installable by apt : sudo apt-get install gifscile

No comments: