2,173 bytes added,
17:17, 3 February 2021 {{InfoBoxTop}}
{{AppliesToAxel}}
{{AppliesToAxelEsatta}}
{{AppliesToAxelLite}}
{{AppliesToAXEL Lite AN}}
{{AppliesToSMARX AN}}
{{AppliesToAXELULite}}
{{AppliesToAXEL ULite AN}}
{{AppliesToSBCLynx}}
{{AppliesTo SBC Lynx AN}}
{{InfoBoxBottom}}
{{ImportantMessage|text=This application note has been validated using the '''kit version''' in the History table.}}
==History==
{| class="wikitable" border="1"
!Version
!Date
!Development Kit version
|-
| 1.0.0
| February 2021
|[[Axel_Embedded_Linux_Kit_(XELK)#XELK_4.0.0|XELK 4.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</code> is a small utility that can be used for this job. This Application Note (AN) shows how to use it on a system running a XELK-based Yocto Linux distribution.
==Installing <code>fbgrab</code>==
Assuming that root file system provides the [[XELK-AN-003:_Package_Management_with_Yocto|<code>smart</code> tool]], the <code>fbgrab</code> utility can be installed as follows:
<pre class="board-terminal">
</pre>
==Capturing screenshots==
The following examples refer to a system using a 1024x768 16bpp 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 /dev/fb0 > test.fb
</pre>
Then convert the raw data to a PNG image file, run the following command:
<pre class="board-terminal">
./fbgrab -w 1024 -h 768 -b 16 -l 1024 -f test.fb test.png
Converting image from 16
Now writing PNG file (compression -1)
</pre>
Alternatively, the raw data file <code>test.fb</code> can be copied to a Linux host where <code>fbgrab</code> is installed.
It is worth remembering that, if the resolution and/or pixel depth are unknown, the [<code>fbset</code> tool http://spblinux.de/2.0/doc/fbset.html] can be used to display such parameters:
<pre class="board-terminal">
</pre>