windowsanimated-gif

Create animated gif from a set of jpeg images


I need something that can be scripted on windows 7. This image will be used in banners.


Solution

  • You can do this with ffmpeg

    First convert the images to a video:

    ffmpeg -f image2 -i image%d.jpg video.avi
    

    (This will convert the images from the current directory (named image1.jpg, image2.jpg...) to a video file named video.avi.)

    Then convert the avi to a gif:

    ffmpeg -i video.avi -pix_fmt rgb24 -loop_output 0 out.gif
    

    You can get windows binaries for ffmpeg here.


    You can also do a similar thing with mplayer. See Encoding from multiple input image files.

    I think the command line would be something like:

    mplayer mf://*.jpg -mf w=800:h=600:type=jpg -vf scale=160:120 -vo gif89a:fps=3:output=out.gif
    

    (Where 800 & 600 are your source width and height and 160 & 120 are the target width and height.out.gif is your target file name)


    I've just tested both of these and they both work fine. However I got much better results from mplayer as I was able to specify the resolution and framerate. Your milage may vary and I'm sure you could find more options for ffmpeg if you looked.