I've never heard of such a program, though that's not to say one doesn't exist. When I make my gifs, I choose my emulators carefully. For instance, ZSNES offers a frame by frame screenshot feature; it'll take a single snapshot and advance the video one frame. For NES gifs, NNnesterJ has a slowdown feature that will slow the video and allow me to easily capture a screenshot for each frame of animation. Tricks like that make it fairly easy. If all that fails you could just rapidly tap the screenshot key and hope you get each frame of animation.
The closest I can get to what you are actually looking for is a video capture program like
CamStudio. With that you could capture a short video and load it into an appropriate image program like Paint Shop Pro.