I need something that can be scripted on windows 7. This image will be used in banners.
相关问题
- Inheritance impossible in Windows Runtime Componen
- how to get running process information in java?
- Is TWebBrowser dependant on IE version?
- How can I have a python script safely exit itself?
- I want to trace logs using a Macro multi parameter
相关文章
- 如何让cmd.exe 执行 UNICODE 文本格式的批处理?
- 怎么把Windows开机按钮通过修改注册表指向我自己的程序
- Warning : HTML 1300 Navigation occured?
- Bundling the Windows Mono runtime with an applicat
- Windows 8.1 How to fix this obsolete code?
- CosmosDB emulator can't start since port is al
- How to print to stdout from Python script with .py
- Determine if an executable (or library) is 32 -or
I'd just like to add to dwurf's answer, that this will generate a gif with the standard 256-colors palette, which does not look very visually pleasing.
I've found two blog-posts and adapted them to my needs, in order to improve the visual quality by using a custom palette for your animation:
Generate the color palette:
Convert images into a regular video with the desired framerate, because the third command only worked with a single input video and not a bunch of images
Now convert the generated video with the generated palette into a more beautiful gif:
You can do this with ffmpeg
First convert the images to a video:
(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:
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:
(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.
The ffmpeg to .avi and .avi to .gif worked, but the only thing to note is that your images must be named in perfect increasing numeric order to work, with no gaps. I cooked up a quick python script to rename all of my images accordingly so that this ffmpeg recipe would work:
And then I stumbled upon a much simpler approach than ffmpeg for doing the conversion, which is simply using ImageMagick's command line convert tool like this
Doesn't get much simpler than that folks.
Gist here: https://gist.github.com/3289840
With ImageMagick:
Based on the answers of Simon P Stevens and dwurf I came up with this simplified solution:
This results in a rate of 1 second per image. Adjust the
framerate
value according to your needs.Simon P Stevens' answer almost got me there:
Let's see if we can neaten this up.
Going via an avi is unnecessary. A
-pix_fmt
ofrgb24
is invalid, and the-loop_output
option prevents looping, which I don't want. We get:My input pictures are labeled with a zero-padded 3-digit number and I have 30 of them (image_001.jpg, image_002.jpg, ...), so I need to fix the format specifier
My input pictures are from my phone camera, they are way too big! I need to scale them down.
I also need to rotate them 90 degrees clockwise
This gif will play with zero delay between frames, which is probably not what we want. Specify the framerate of the input images
The image is just a tad too big, so I'll crop out 100 pixels of sky. The transpose makes this tricky, I use the post-rotated x and y values:
The final result - I get to share my mate's awesome facial expression with the world: