Taking a Screen Shot of an Embedded Linux Framebuffer
Solution 1
Take a look at fbgrab, an application that does just that (it saves the framebuffer content as a png).
Solution 2
You can simply capture the framebuffer to a file and open it in any raw image viewer or try online eg: https://rawpixels.net/
cat /dev/fb0 > fbdump
Solution 3
It might not be possible / easy to do it directly with ImageMagick.
The Linux kernel 4.2 documentation https://github.com/torvalds/linux/blob/v4.2/Documentation/fb/api.txt#45 says:
Pixels are stored in memory in hardware-dependent formats. Applications need to be aware of the pixel storage format in order to write image data to the frame buffer memory in the format expected by the hardware.
Formats are described by frame buffer types and visuals. Some visuals require additional information, which are stored in the variable screen information bits_per_pixel, grayscale, red, green, blue and transp fields.
Visuals describe how color information is encoded and assembled to create macropixels. Types describe how macropixels are stored in memory. The following types and visuals are supported.
A list of visuals and types follows, but the description is not enough for me to understand the exact formats immediately.
But it seems likely that it might not be a format that ImageMagick will understand directly, or at least you'd have to find out the used format to decide the ImageMagick options.
waffleman
Updated on July 31, 2022Comments
-
waffleman almost 2 years
I'm running Embedded Linux on an evaluation kit (Zoom OMAP35x Torpedo Development Kit). The board has an LCD and I would like to be able to take screen shots convert them into a gif or png. I can get the raw data by doing the following: "cp /dev/fb0 screen.raw", but I am stumped on how to convert the image into a gif or png format.
I played around with convert from ImageMagick (example: "convert -depth 8 -size 240x320 rgb:./screen.raw -swap 0,2 -separate -combine screen.png"), but have been unable to get an image that looks right.
Does anyone know of any other tools that I could try out? Or does anyone have tips for using ImageMagick?
-
waffleman over 14 yearsI tried out fbgrab, but it does not support "low-end bit depths". For my device the bit depth is 8. :( However, I looked at fbshot - sfires.net/fbshot. fbgrab is based on fbshot and it supports 8 bit depth. fbshot works just fine.
-
Georg P. about 4 yearsThis online converter didn't work for me, but here I found a Perl script that did the conversion nicely: cnx-software.com/2010/07/18/how-to-do-a-framebuffer-screenshot
-
matanster about 4 yearsIs it normal to get several megabytes of all zero content from this way of dumping /dev/fb0 ?
-
klasyc over 2 yearsfbgrab has been moved to GitHub. I also had a problem with ancient version 1.2 which did not handle RGB565 well - fixed by update to the recent version.