The way i did it was a bit complicated, since i wanted them to loop smoothly. Used Hypercam2 to record the screen, then brought the recording into adobe after effects to cut the clip up til it looped smoothly. Then brought that clip in to photoshop to save it as a gif. Lots of little extra steps in there that would take too long to explain, though. The simplest method would be a program called Gyazo GIF, but youll likely never get a smooth loop that way.