How to create animated gif of a screencast?

view full story

http://askubuntu.com – I've seen animated gifs of screen casts (like the one below) promoted a few times on this site as a way to improve answers. What toolchain are people using to create these? Is there a program that does this automagically, or are people taking screencasts, converting them into a series of static frames, and then creating the gif? (HowTos)