Changes

Jump to: navigation, search

XELK-AN-010: Capturing framebuffer screenshots

529 bytes added, 15:17, 4 February 2021
no edit summary
| 1.0.0
| February 2021
|[[Axel_Embedded_Linux_Kit_(XELK)#XELK_4XELK_3.0.0|XELK 43.0.0]] , [[AXEL_ULite_and_SBC_Lynx_Embedded_Linux_Kit_(XUELK)#XUELK_2.0.1.2F2.0.2.2F2.0.3|XUELK 2.0.3]]
|-
|}
==Introduction==
In certain situations, it is necessary and/or convenient to grab a screenshot of the full display from the framebuffer directly, for example for debugging purposes or documentation. <code>fbgrab<By using the well-known [https:/code> is a small utility that /imagemagick.org/ ImageMagick tool], this job can be used for this jobaccomplished straightforwardly. This Application Note (AN) shows how to use it on a system running a XELK-based Yocto Linux distribution.
==Installing <code>fbgrab</code>==
==Capturing screenshots==
The following examples refer to a system using a 1024x768 16bpp 1024x600 24bpp framebuffer, which is mapped to <code>/dev/fb0</code>.
When the display shows the image to be captured, to grab a "raw" screenshot and save it to file, issue the following command:
<pre class="board-terminal">
cat root@sznpc:~# dd if=/dev/fb0 > testof=screenshot.fbraw4800+0 records in4800+0 records out
</pre>
Then convert the raw data to a PNG image file, run the following command:
<pre class="board-terminal">
./fbgrab root@sznpc:~# convert -w 1024 size 1024x600 -h 768 -b 16 -l 1024 -f testdepth 8 rgba:screenshot.fb testraw screen0.pngConverting image from 16Now writing PNG file (compression -1)
</pre>
Alternatively, if the <code>fbgrabconvert</code> utility can not be installed onto the target's root filesystefilesystem, the raw data file <code>testscreenshot.fbraw</code> can be copied to a Linux host where <code>fbgrabconvert</code> is available.
It is also worth remembering that, if the screen parameters such as resolution or pixel depth are unknown, the [http://spblinux.de/2.0/doc/fbset.html <code>fbset</code> tool] can be used to display them:
<pre class="board-terminal">
root@sznpc:~# fbset
 
mode "1024x600-67"
# D: 51.201 MHz, H: 43.538 kHz, V: 67.085 Hz
geometry 1024 600 1024 600 32
timings 19531 104 43 24 20 5 5
accel false
rgba 8/16,8/8,8/0,8/24
endmode
</pre>
The numbers following <code>geometry</code> indicate the resolution (1024x600) and the bits required to represent a pixel (32). In this case, 8 bits are used for each channel (reg, green, blue, and alpha) resulting in 32 bits combined. That is why the <code>depth</code> parameter of <code>convert</code> was set to 8.
4,650
edits

Navigation menu