1

I often have the need to illustrate a little section of coding that would be best achieved by showing an animated gif of how the code is typed. I see these kind of things often enough that I feel there must be tools available to make it easier. Here is such an example:

enter image description here

So the way I've done it (not the above image, that's someone else's) is to do a screen capture after every keypress, paste that image as a new layer in a document in GIMP, crop the entire document with all layers to the section I'm interested in and then export as gif.

As you can imagine, taking a screen grab and pasting it into GIMP after every single key press is tedious work. Also, I have to then manually tweak the timing of each frame to simulate that natural appearance of text being typed by a human.

Surely there must be tools or techniques than can speed up this process. I was thinking for instance that if there is a tool that captures video of the text being typed, then breaks it up into images for each frame, then combines those images into a gif but removing duplicate frames and adjusting the duration of the remaining frame accordingly. So each frame will be unique but they will all have different durations.

Any pointers to software (preferably free and preferably for Windows) would be much appreciated.

  • Welcome to GD.SE - Please look through tour to get a sense of our community – who we are and what we’re about. Then look over How to Ask and How to Answer a question to see what makes a good query here, and how best to frame it. FWIW the example you showed was from Mac OS where they can natively screencap to video using Quicktime Player and choose gif as an export target. – GerardFalla Sep 18 '19 at 18:01
  • Its quite reasonable amount of work to make script that saves a screen capture to disk for any keyboard event, and each xxx mouse event on windows. But such software exist allready. – joojaa Sep 18 '19 at 18:13
  • 2
  • Don't use GIFs - use videos instead. They have a much smaller file size and a higher quality. – Zach Saucier May 25 at 17:45
2

I'd do the following if I was making a sizable batch of these gifs:

  • Record the screen of me typing using any of the tools in Scott's link in his comment above
  • Import the clips into Adobe After Effects
  • Create a new composition for each clip and trim as needed
  • Then I'd use the GifGun After Effects plugin to export them as GIFs.

(There's even an option to batch render with GifGun)

| improve this answer | |
1

On the Windows side, I have used (and still use) Screen2Gif which is freeware and quite effective. I have other more polished tools available for more intensive captures, but for a quickie grab 'n go to gif, it works.

https://www.screentogif.com/

Hope that helps

| improve this answer | |
0

Here is a solution that uses the software Natron.

Cross platform & open-source compositor for visual effects and motion graphics industry

Teaching how to use Natron is out of the scope of this answer so please check out some Natron tutorials first.

In one Text node put the source code you want to animate. In another Text node put in the following expression:

text = Text1.text.get()
ret = text[:frame-1]

Now, when you play it back you will have one character being "typed" per frame.

enter image description here

If you want to change the speed of it there is currently a bug preventing this. The current work around is to use a Constant node. Here is my find node setup.

enter image description here

You can then export each individual frame as a png (Natron doesn't allow exporting to animated gif) and combine them into a gif in other software (e.g. Imagemagick).

Whilst this works the downside is that you will lose code formatting and highlighting. Natron does allow Rich text editing via Pango but you will have to explore this yourself.

| improve this answer | |
  • 2
    this sounds like a waaay more complicated method than simply screencap while typing code... note how the words change color according to semantics after it's typed. – Luciano May 26 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.