fbdump is a simple tool that captures the contents of the visible portion of the Linux framebuffer device and writes it to the standard output as a PPM file.
In other words, it takes a screenshot of anything running on the framebuffer. The project currently has fairly complete support for packed-pixel framebuffer types and also works with the VGA16 framebuffer driver.
fbdump was inspired by an even simpler program I came across ages ago called fbsnap, which I believe was written by Gerd Knorr (although no author is mentioned in the source code of that program, so I could be wrong). fbdump bears little relationship to fbsnap, however, and is generally much more useful. It supports framebuffers employing a greater variety of pixel and colour models, works (should work?) on big- and little-endian architectures, and is reasonably quick (although reading from video memory is never going to be super fast).
I first wrote fbdump many moons ago when I needed a quick and simple way to grab lots of images from the framebuffer. As most of you will probably know, although it's possible to do a raw framebuffer dump by performing a simple cat /dev/fb0 command or similar - depending on what pixel format and colour model your framebuffer uses - the results are not always particularly useful. With fbdump, on the other hand, you always get a nice, portable, 24-bit, true-colour image - since it takes care of any pixel format or colour-space conversion required (at least for formats it supports).
Why does fbdump save the image as a PPM - rather than, for instance, a PNG - you might ask? Well, a PPM is cheap to write out and doesn't require linking against any external libraries to do so. On the x86 architecture, fbdump currently compiles down to a miniscule 8K executable once stripped - and has no dependencies other than the standard C library. Having said that, I may get around to adding support for PNG at some point. It's not strictly necessary, though, because with the NetPBM package it's easy to convert PPMs into something more useful. For example, you can do something like
fbdump | pnmtopng > grab.png
to output the framebuffer as a PNG. PPMs can also be read directly by most open source image processing packages, such as the Gimp and ImageMagick.
fbdump currently supports the following command-line options:
-fb < string > Specifies the framebuffer device to grab from is < string >
-vt < num > Bring virtual terminal number to the foreground before grabbing (and return to the current terminal afterwards)
-delay < num > Delay seconds after switching, but before grabbing.
If the -fb option is not provided, fbdump defaults to grabbing from the device /dev/fb0. You can also specify the framebuffer via the environment variable FRAMEBUFFER (a value supplied with the -fb switch on the command line will override this). For example:
FRAMEBUFFER=/dev/fb1 fbdump >out.ppm
What's New in This Release:
· A fix for a long-standing bug in handling of colour maps, support for 64-bit architectures and a lot of cleaning up.