Animated GIF 101

Today we are going to learn about our fun friend, the animated GIF! We will be using a combination of GIMP ( and any recent version of Blender (2.6X) to create this 11 frame animated GIF from a still image. If you are going to use  a cycle you have already made in Blender, you can skip down to the last section: “Manipulating the Image Sequence in GIMP”

For pre-requisites, you should be familiar with basic GIMP functions such as layering, copy/pasting, painting, cloning, and erasing.  In Blender, you should be comfortable with editing mesh, UV-unwrapping, weight-painting/vertex groups, basic rigging and animating. (Don’t worry we will try to show you the hard parts!)

Preparing the Image in GIMP

To begin, we need to open our image in GIMP (2.8 here):

(Above: The taco man is pleased to be in GIMP now.)

Now we need start cropping the taco man’s body parts using the Free Select tool (pressing “f” will activate it).

Now that we have the selection of the first limb, we will need to copy, paste, and create a new layer–which is easy if you do it in the correct manner! It will be wise to create layers for each body part as shown below to make isolation and the next few steps a bit more organized. Simply Ctrl-C, Ctrl-V, and then click the “Create new layer” button as shown below:

(Above: In this step it is critical that you do not move the layer.)

And now the part where you reach for your tablet if you so choose, and it is erase time! It is something you must do carefully as to preserve the already aliased lines in this particular picture. If you mess up, Ctrl-Z to undo. If you only mess up a little bit, you can easily go back and clone lines back in as well.

(Above: Using the default brush worked well enough here.)

And now to get a bit more technical. We will now need to fill that poor taco man’s body in! In this situation, the clone tool is our friend. This tool will take some getting used to if you have never done it before, but it is well worth learning. We need to clone the pixels behind his body parts so that when we animate, (yes in Blender, and yes we will get to it 😀 ) we have more free range of motion with a convincing figure behind them. For this step, make sure you duplicate the original image and have all layers turned off except what you are working on.

Note–Make sure you have the layer you want to work on highlighted as in the photo below, as well as making sure that you have the entire layer “selected” before you start painting. In GIMP selections and layer highlights are what controls where your brush will affect your image. If you are painting and nothing happens, you either have a layer “on top” of the selected layer you are working on, or you do not have the region you are working on selected which is most easily fixed by hitting Ctrl-A, or going to the “Select” menu and clicking “All”.

(Above: When using the clone tool, use Ctrl+Right click to place the cursor on the area you want to use as the clone template. Then “stamp” as desired!)

When you are finished with all of your body parts that you choose to mask, you should have a perfect little taco who cannot fight back anymore. Poor taco man :(.

(Above: You can get creative by box selecting some regions and flipping or mirroring them. This is how the near perfect shadow oval was achieved.)

By this point, we will have the image information we need to start migrating to Blender. First we will Export all the body parts in one image, and then Export the taco man body/BG to another.

(Above: You will notice that the limbs are on an alpha BG, this will come into play very soon!)

Preparing the Blender Scene

And finally, we move on to Blender. We start with a clean scene, select all, delete all.

  • Starting in Top View (NUM7), we add a camera and a plane.
  • Move the camera to (0,0,2) using G key, Z key, 2, enter.
  • Set the camera to Orthographic and the scale to 1.0.
  • Scale the plane to 1BU x 1BU by using S key, 0.5, enter.
  • Set the render size, in our case it is 600 x 575 px.
  • You should now have a similar setup (and yes there is something wrong!):

(Above: You will need to scale the plane down in the Y direction. This is accomplished by calculating the width/height, 575/600=.958333. Now you scale using S key, Y, .95833, enter. and now the plane should be well placed within the camera frame.)

Now that we have a working plane, we will add a material/texture to it. We will be adding the body/BG to this plane. Below is a photo of the results of the first material:

(Above: Notice that the Shading is set to “Shadeless”. We will use no lights in this scene.)

Now that you have this setup, duplicate the plane using Ctrl-D. Move in the Z direction (towards the camera) about .1 BU. This will not effect the appearance of the plane since we are in Ortho mode for the camera.

(Above: I moved the other plane to a different layer for now.)

With both planes visible, you should get back something similar to the original image in the camera view (GLSL), when you render, it should nearly indistinguishable from the original image:

Rigging and Animating

This is the part we will move through a bit more quickly. You will go into edit mod on each plane to start modelling your shell meshes for the body and the limbs. Use common sense in your mesh density. This will affect the quality of where each item stretches.

After you have finished your modeling, you will need to UV unwrap your mesh. The easiest way to quickly get the desired results (as long as you modeled your meshes in place as the image shows) is to go into camera view, select your vertices, unwrap using U key and selecting “Project from view (bounds)“. The below image shows reasonably ideal results:

(Above: You will notice this is a single mesh. After modeling it can be a bit easier to join the two meshes for rigging and animating. This is of course preferential. )

And now another quick part, (or not so quick…) the rigging. For this tutorial please seek tutorials on how to rig. If you are very serious, check out Humane Rigging – Blender Foundation Training DVD <–please strongly consider purchasing a copy to support the Foundation 🙂 . Below will show a basic rig setup:

 (Above: Weight Paint mode. Remember, your mesh object must already be parented to your armature, and you can always tab back to edit mode on your mesh to hide vertices you do not want to accidentally paint. Second, remember to give your bone a swing to make sure you painted your weights right!)

Once you have finished your rig, it is time to bring the taco man back to life. Again, please get help on the subject of animation if you need to, this is going to go fast.

In our case, we are making a basic “walk cycle”, in our case, a “dance cycle”:

  • We need to first decide on our frame count and rate. For this example 14FPS for 11 frames works rather well. (start frame: 1, end frame: 11)
  • Start off by posing your object to your start/stop position.
  • Insert a key on the first frame, and then copy that pose for all bones, paste this pose on frame 12, and insert another key.

Note: Yes, frame 12. We go to 1 frame for our last rendered frame so that there is not a strange pause in the cycle, because you would suddenly have 2 identical frames next to each-other. 

  • Now go to frame 6 (or close to center) and add another pose for your desired bones, add another key.
  • By now you have a simple animation which you can playback using Alt-A.

When you are satisfied with your animation results, it is time to render!

We will be using any image format of your choice, into whatever folder you choose. The goal is to render a sequence of 11 images to import into GIMP for the final product output. Once finished, you are done with Blender, and will migrate back to GIMP for the remaining tutorial.

Manipulating the Image Sequence in GIMP

Open GIMP and create a new image of the same size as our render: 600 x 575px.

  • Delete the background layer, you should have a simple alpha displaying in the window.
  • Now you can either drag and drop your images onto the layer panel, or you can go to File–>Open as Layers and pick the multiple images. They should be sequentially inserted in the layer panel.

(Above: BEWARE! Please make sure your frames are in the correct order. Descending from top to bottom.)

Once imported, go to the menu: Filters—> Animation—> Playback. This will give you different playback speeds, and allow you to double check your frame sequence one last time before output.

Note: If you would like, you can go to Filters—> Animation —> Optimize for GIF and GIMP will automagically compress your layers appropriately to make the final output smaller in size. (This was done for this particular tutorial.)

Now it is time to make our GIF a reality. Go to menu File—> Export, select file type GIF, name your file and click “Export”. You should now have a new dialog:

 (Above: This is the final step!)

Note: Your delay between frames is how you control the speed of the animation. 50ms for 11 frames gives us just over a .5s cycle.

 And here are the results! One at normal dancing taco, and one EXTREME dancing taco!

And here is an example of an animated GIF created using 3D tank tracks and Freestyle for lines:

Happy GIF-ing!!