LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   How to take a screenshot with /dev/fb0 (https://www.linuxquestions.org/questions/slackware-14/how-to-take-a-screenshot-with-dev-fb0-918705/)

raypen 12-14-2011 10:00 AM

How to take a screenshot with /dev/fb0
 
I would like to take a framebuffer screenshot
from the command line and have been trying to
use
Code:

cp /dev/fb0 file
I have been switching to tty2 with Alt-F2 to do this
but keep winding up with a screenshot of whatever is
on the tty2 screen. How do I specify tty1's screen?

I am aware that I could use /dev/vcs1 to do this
but that only gives me a text representation instead
of a raw screen dump that I can then later convert
to PNG.

ahmadj 12-14-2011 10:55 AM

perhaps you could do...

*CTRL-ALT-F2*
sleep 2 && cp /dev/fb0 file
*CTRL-ALT-F1*

Keith Hedger 12-14-2011 11:22 AM

why not use fbdump as you can see it should do what you want
Code:

keithhedger@SlackHolly:~-> fbdump --help
fbdump 0.4.2

(c) Richard Drummond 2001-2007

Dumps the contents of the framebuffer to stdout as a PPM file.
Usage:
  -fb <string>  Path to the framebuffer device to dump is <string>
  -vt <n>        Bring virtual terminal no. <n> to the foreground before dumping
  -delay <n>    Wait <n> seconds before dumping
  --help        Show this help


raypen 12-14-2011 06:14 PM

I would have bet a lot of money that someone would recommend delaying the snapshot long
enough to revert to the Alt-F1 screen so /dev/fb0 would refer to the proper screen. That
does give me a nice 3MB or so raw file which can be converted to .png as follows:

Code:

iraw2png 1024 768 < screenshot.raw > screenshot.png
I tried fbdump --help but apparently I don't have that on my Slack 13.37 64 bit system.

I was under the impression that there were several /dev/fb's since multi-screen comfigurations
are possible but in /dev there is only one; fb0. Apparently multi-screen is only available
in xorg with a xorg.conf file altered to indicate multiple screens. Kind of makes me wonder
just what difference there is between /dev/vcs1... and /dev/fb0. Only /dev/fb0 will get
you a raw screen dump whereas /dev/vcs... will only get a text representation of the
screen and no graphics.

Keith Hedger 12-15-2011 04:30 AM

Sorry fbdump is available at slackbuilds.org


All times are GMT -5. The time now is 04:55 PM.