A workflow for animated GIFs using Blender and GIMP
I made a GIF of a part of my screen to demonstrate the foot pivot switching in the PitchiPoy Blender animation rig. After all the cropping and skipping of frames, the final animated GIF is 1.5MB. The source .mkv file, with all the frames, and 1440p resolution, was 1.6MB! Whether this was an appropriate use of a GIF, given its size, I’m not sure. We’ll see if my web host ever complains. At the moment, sometimes a GIF is what we want, easy to embed and share, and now I have a workflow for it.
I had a screen recording generated with Vokoscreen (for which I downloaded a Mageia .rpm package, but I cannot seem to find it online at the moment). Initially I tried cropping it and cutting it in Kdenlive (using their Appimage, because the very outdated Mageia 5 rpm version was crashing on renders). This worked fine, but Kdenlive render profiles still have me a bit confused, especially when it comes to non-standard resolutions. It is probable that I could export the project as a GIF, based on this clue but I had an epiphany that saved me from having to figure out more about Kdenlive for now: I can just use Blender to edit the video and output the PNGs.
The workflow for this GIF turned out to be as follows:
- Take a video of the foot rig controls in action, using Vokoscreen. This was straightforward, once I’d decided which software to use and tested that it’s stable (two perennial problems in Linux: too many potential tools for the job; and too many of them turn out to be unstable on a given system).
- Edit the video in Blender, and save it as PNG images of the frames. Further detail below.
- Open the images in GIMP, and export them as an animated GIF. Further detail below.
Steps in Blender:
- Open a new file. Switch from the
Video Editingscreen layout.
- Change the upper left pane from
Properties. This will make it easy to adjust render settings, like resoluton, on the same screen.
- In the
Video Sequence Editor(VSE) pane,
Movie. Choose the file that Vokoscreen saved.
- Cutting If all you want is to keep a subset of the frames in the original video, set the start and end frames in the
Timelineeditor (or at
Frame Range). That’s it!*
- Cropping Even though I call this “cropping,” in fact we don’t need to use what Blender calls
Image Cropto reduce the image area included in the GIF. Instead, while looking at the preview in the
UV/Image Editorpane, adjust
Render(camera icon) >
Render Resolutionuntil the desired framing is achieved.
- Deciding a frame rate You can reduce the final file size by skipping frames. In this case the actual frame rate doesn’t matter since we’re outputting a pile of .png files and using GIMP to create the animation. Set
Frame Stepto 2 if you want to output only every second frame.
- Saving the video Check
Post Processingin the
Properties Editorto render the video from the
Video Sequence Editor, not the camera in 3D view (Manual Reference). Choose
PNGfrom the file format menu under
Output. Now render the animation in one of several ways. The CTRL-F12 key combination is used by my window manager, so I use the
Render Animationmenu item under
Infobar, or the
*If you need to do something fancy, cut the strip in the sequence editor by positioning the frame marker and hitting
K. Delete unwanted bits with
X. Move strips with the right mouse button (and
G if wanted). Deliciously consistent with the other operations in Blender. Probably not intuitive to new users.
Now there should be a load of .png files in a directory (/tmp on my system). They’re named by frame number, so if you’ve rendered other files into the directory before, there can be extras that don’t belong (ask me why it’s at the top of my mind right now).
The next thing is to get GIMP to make these files into a GIF.
Steps in GIMP:
Open as layersall the PNG files to be included in the GIF. Since they’re named by frame number, they’ll be loaded in the right order.
Optimize (for GIF). I tried with and without this step, and using it reduced my file size from 8.2MB to 1.5MB.
Export asand give the filename the extension .gif. Check the
as animationbox and set the delay to 1/(framerate) – e.g. if the framerate is 12fps, the delay is 1⁄12 of a second, or about 83ms. I also selected