# VBForums CodeBank > CodeBank - Visual Basic 6 and earlier >  Utility to capture animated GIFs from the screen

## Elroy

.
_First and foremost, I want to acknowledge that the vast majority of this code is from code written by The Trick (found here), and a HUGE thanks goes out to him for that work._

Basically, what I've done is, take his Animated GIF Creator and added the ability to capture the GIF's animation frames from your screen.  For it to do anything useful, you will need to set-and-size the RED selection window on some part of your screen that is animating (such as a game or other movement).  Although it's red, it moves and resizes just like a typical form.  Only the area *within* the red borders is captured.

Once you've selected the screen region to capture, click the "*Start Capture*" button, which will then say "*Stop Capture*".  Let the capture run for as long as you like (but not too long or your GIF file will be huge).

Also, before doing that, be sure your "*Interval*" is set to what you want.  It defaults to 200ms, which is 5 frames per second.

Once you've captured some frames, you can then save them to an animated GIF with the "*Save*" button.

And that's about it.  There are other buttons for manipulating the frames, and also an "*Add*" button for loading individual pictures for including them as frames.  But the "*Start/Stop Capture*" capture button and the "*Save*" button are most useful.

Also, @Trick, I deleted all the Russian comments, as they were confusing some people.  I truly hope you don't mind.  And again, _THANK YOU_ for your work.

As an FYI, both the main form and the selection form have always-on-top set.  And they also remember their locations and sizes between executions.

Enjoy,
Elroy

And as a final note, there's also a "*Threshold*" setting.  However, when capturing from the screen, this isn't used.  This is used only when the "*Add*" button is used, and some image with an alpha channel is specified (such as many PNG and/or TGA files).  For GIF files, this alpha channel is reduced to either transparent or opaque (per pixel), and this "threshold" is used for those purposes.  Again, none of that has any meaning when capturing from the screen.

There's also a "*Loop*" option.  You can specify how many times an animated GIF "loops", if you like.  Zero (the default) tells it to loop infinitely.

*UPDATE001*:  Just made it a bit more bullet-proof, and also tweaked on the screen-frame-capture code to make it a bit faster.  Truth be told, that could be tweaked more, but it's running fast enough for my needs.  You'd have to go significantly below 100ms per frame to overrun it, I believe.

----------

