Not exactly a gif-image, because of license restrictions (which may also be a problem with any OSS library), but image/png, image/jpeg and (Chrome) image/webp and any animations built of these.
(This is a political issue and not a technical one.)
To have gif, you would have to implement the algorithm by your own and pay fees or ...
Yeap. Check out the code here. https://github.com/fraserxu/gifme There's an awesome library to do this. It's basically capture serval frames and use a algorithem to generate it.