chroma key screen grabs

Oddly-shaped windows are a pain to screen grab. Netpbm to the rescue!

  1. Make a blue (or green, or whatever isn’t used in your window) image larger than the window, like this:
    ppmmake blue 800 600 | pnmtopng > ~/Desktop/b.png
  2. Display the image, and arrange your program in front of it.
  3. Take a screenshot.
  4. Crop the image, and set the background transparent.
    pngtopnm Screen\ shot\ 2011-03-27\ at\ 10.12.52\ .png |\
     pnmcrop |\
     pnmtopng -transparent blue > ICP-2007.png

Ta-dah!

(and yeah, this is a Windows program running under Wine on OS X …)