I need to save an animation as an animated GIF.
Can this be done from Blender? cheers.
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It only takes a minute to sign up.Sign up to join this community
No, GIF isn't supported. While the encoding library (FFmpeg) used by Blender supports GIF encoding, it's unlikely support for this format will ever be added.
Your best option is to render an image sequence and assemble them in another external application. This is really trivial to do however and you can find some good programs or methods around the internet by doing a simple search.
I created an addon that allows you to render or import animated GIFs with Blender. The addon is called Bligify.
You can convert a .png sequence to gif with ImageMagick.
Assuming you've already rendered your animation as a .png sequence, install ImageMagick and open up a terminal, go to your output directory, and execute:
convert -delay 1x30 *.png video.gif
This will convert all .png files in that directory to one .gif file.
The delay parameter defines how many ticks each image should be visible. 30 fps (1/30 sec) is used in the example above.
You specified you wanted an in-house solution. As it was stated that's not possible outside of addons that introduce outside elements. You can go the other route though and download the ffmpeg library that is already within blender, allowing you to access it directly through a command prompt or powershell. Google ffmpeg, download the latest stable release, extract, drag the ffmpeg.exe into the folder (or setups paths) of the things u want to turn into gif. Then you can open a command console there and use the generic:
ffmpeg -i input.mkv output.gif
In many situations it may be preferable to make the dimensions and any effects desired in blender vse, with a gui, and export just the desired segment as a .jpg or png strip. If you are committed to high quality gif images you can expand on what your command uses a bit, search google. But in general some things u might want to pair with it:
ffmpeg -i input.mkv -vf scale=500:-1,unsharp=lx=13:ly=13:la=1.0 output.gif
if you want to specify the scaling operation as lanczos or something else, its bicubic by default. But you only scale if you need to change the scale of the input, otherwise it translates over to the output automatically as is.
for jpeg/png the operation is just
You probably want to set the fps and start number tho so it would be like: For an image strip sequence named 800.png....onwards:
ffmpeg -framerate 24 -start_number 800 -i %d.png -vf scale=500:-1,unsharp=lx=13:ly=13:la=1.0 output.gif
For jpeg the scaling operation uses -2 instead of -1 for the automatic proportional scaling feature. I don't know if crf values work for gif or not but you'd just toss a -crf 18 before the output perhaps.
my pictures8002...my pictures8899
would be -start_number 8002 -i "my pictures"%d.png
i think it was -vframes 8012 if you wanted to only make the gif just from images 8002 to 8012; just toss it after the input in that situation. should work for video format outputs, never tried for gif.
So, I had just run into this dilemma and couldn't get the above answers to work (or were too complicated). I ended up learning how to do it in Krita. In case anyone stumbles here in the future, here's a step-by-step process I came up with. Obviously, you'll need Krita. Once you've installed and linked FFMpeg, you don't have to do so each time and the process becomes quicker. BTW, I'm on Windows 10 64bit.
-Install Krita, if you haven't already. It's free.
-Download ffmpeg according to your system setup and extract to a safe place, or wherever. Mine is just on the C drive.
-Open Krita and create new document according to your image sequence size.
-File > Import animation frames...
-Now, click Add images and select all your frames, then select OK to import.
-Make sure the Timeline and Animation dockers are open: Settings > Dockers > Timeline; Animation.
-If there is a jitter at the end of your sequence that wasn't there in Blender, you may need to readjust your start and end frame values. This can be done in the Animation docker.
-Once it's all ready for export, simple go to File > Render animation. Here, be sure Video is selected and the first and last frames match what you set in the Animation docker, as well as the other values like dimensions and FPS.
-In the FFMpeg, link to where the ffmpeg.exe file is located. Example: C:\Ffmpeg\bin\ffmpeg.exe (where mine is).
-Be sure Render as: GIF image is selected and select your output location.
Now that I've seen how easy this was firsthand, I'll be using Blender and Krita in tandem when making gifs! Hope this helps the next person as inept or lazy as I. Let me know if I wasn't clear enough or if you have issues and I'll try to help.