从一组jpeg图像创建动画gif [英] Create animated gif from a set of jpeg images

查看:109
本文介绍了从一组jpeg图像创建动画gif的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要可以在Windows 7上编写脚本的内容.此图像将用于横幅广告.

解决方案

您可以使用 ffmpeg

首先将图像转换为视频:

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

(这会将图像从当前目录(名为image1.jpg,image2.jpg ...)转换为名为video.avi的视频文件.

然后将avi转换为gif:

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

您可以在此处获取 ffmpeg的Windows二进制文件.


您也可以使用 mplayer 做类似的事情.请参见从多个输入图像文件进行编码./p>

我认为命令行类似于:

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

(其中800和600是您的源宽度和高度,而160和120是目标宽度和高度.out.gif是您的目标文件名)


我都测试了这两个,它们都工作正常.但是,由于可以指定分辨率和帧速率,因此从mplayer获得了更好的结果.您的里程可能会有所不同,如果您查看ffmpeg,我相信您可以找到更多选择.

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

解决方案

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.

这篇关于从一组jpeg图像创建动画gif的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆