a technical notebook
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
2.3 KiB

  1. Thursday, December 18, 2014
  2. ===========================
  3. screencast gifs
  4. ---------------
  5. Looking to make some GIFs of things that happen on my screen, found `byzanz`.
  6. $ sudo apt-get install byzanz
  7. byzanz-record -x 1 -y 1 --delay=4 -h 150 -w 700 hello_world.gif
  8. Options:
  9. - `-x` and `-y` set origin of capture on screen
  10. - `-h` and `-w` set height and width to capture
  11. I think I need a more clever way to trigger / manage this than just fiddling
  12. with CLI options, but it works really well and produces lightweight image
  13. files.
  14. I think it would be cool if there were a utility that let me use arrow keys /
  15. hjkl / the mouse cursor to visually select a region of the screen. It could
  16. return x, y, height, and width, then I'd let byzanz handle the capture.
  17. That can't be the _hardest_ thing in the world to do.
  18. -> ☆ <-
  19. [xdotool](http://www.semicomplete.com/projects/xdotool/) seems like kind of a
  20. swiss army knife, and has a `getmouselocation` command. Theoretically, at
  21. least, you can have it respond to events, including a mouse click. I can't
  22. quite wrap my head around how this is supposed to work, and my first few
  23. attempts fall flat.
  24. [GNU xnee](https://www.gnu.org/software/xnee/) might also be promising, but I
  25. don't really get anywhere with it.
  26. Eventually I find an
  27. [Ask Ubuntu](http://askubuntu.com/questions/107726/how-to-create-animated-gif-images-of-a-screencast)
  28. thread on creating screencast gifs, which points to
  29. [xrectsel](https://github.com/lolilolicon/xrectsel), a tool for
  30. returning the coordinates and size of a screen region selected with the mouse:
  31. brennen@desiderata 22:06:28 /var/www/workings-book (master) ★ xrectsel "%x %y %w %h"
  32. 432 130 718 575%
  33. I wind up with [`gif_sel`](https://github.com/brennen/bpb-kit/blob/master/bin/gif_sel):
  34. #!/usr/bin/env bash
  35. # requires:
  36. # https://github.com/lolilolicon/xrectsel.git
  37. eval `xrectsel "BYZANZ_X=%x; BYZANZ_Y=%y; BYZANZ_WIDTH=%w; BYZANZ_HEIGHT=%h"`
  38. byzanz-record -x $BYZANZ_X -y $BYZANZ_Y --delay=4 -h $BYZANZ_HEIGHT -w $BYZANZ_WIDTH ~/screenshots/screencast-`date +"%Y-%m-%d-%T"`.gif
  39. I'll probably wind up with a couple of wrappers for this for different lengths
  40. of recording (for starting with dmenu), though it would be nice if I could just
  41. have it record until I press some hotkey.