Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to screen capture a region to GIF using Byzanz

📅 2014-Jan-24 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

Byzanz can be used to screen capture and save it to an animated GIF file. To capture a region of the display, you can pass it the XY coordinates of the top-left corner of the region and the width and height of the region. A more intuitive method would have been to draw a region on the display and have Byzanz capture that.

Thanks to Rob W, you can do that using his Bash script byzanz-record-region, which can be found here. Getting this to work takes a few steps:

$ git clone https://github.com/lolilolicon/FFcast2.git
$ cd FFcast2
$ make

Move the xrectsel binary to location accessible from your PATH.

$ byzanz-record-region

Your mouse cursor turns into a cross-hair. Draw the region on the display. A countdown of 10 seconds is shown followed by a beep. Recording begins and ends after 10 seconds. You can find the resulting animated GIF file in /tmp/recorded.gif.

$ byzanz-record-region 30 foobar.gif

Tried with: Ubuntu 12.04