从一组 jpeg 图像创建动画 gif [英] Create animated gif from a set of jpeg images
问题描述
我需要可以在 Windows 7 上编写脚本的内容.此图像将用于横幅.
I need something that can be scripted on windows 7. This image will be used in banners.
推荐答案
您可以使用 ffmpeg
首先将图像转换为视频:
First convert the images to a video:
ffmpeg -f image2 -i image%d.jpg video.avi
(这会将当前目录中的图像(名为 image1.jpg、image2.jpg...)转换为名为 video.avi 的视频文件.
(This will convert the images from the current directory (named image1.jpg, image2.jpg...) to a video file named video.avi.)
然后将 avi 转换为 gif:
Then convert the avi to a gif:
ffmpeg -i video.avi -pix_fmt rgb24 -loop_output 0 out.gif
您可以在此处获取 ffmpeg 的 windows 二进制文件.
您也可以使用 mplayer 做类似的事情.请参阅来自多个输入图像文件的编码.
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
(其中 800 & 600 是您的源宽度和高度,160 & 120 是目标宽度,height.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)
我刚刚测试了这两个,它们都可以正常工作.但是我从 mplayer 得到了更好的结果,因为我能够指定分辨率和帧率.您的里程可能会有所不同,我相信您可以找到更多关于 ffmpeg 的选项.
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屋!