Open main menu

DAVE Developer's Wiki β

Changes

XELK-AN-010: Capturing framebuffer screenshots

7,427 bytes added, 10:21, 25 August 2023
no edit summary
{{AppliesToAxelEsatta}}
{{AppliesToAxelLite}}
{{AppliesToAXEL Lite AN}}
{{AppliesToSMARX AN}}
{{AppliesToAXELULite}}
{{AppliesToAXEL ULite AN}}
{{AppliesToSBCLynx}}
{{AppliesTo SBC Lynx AN}}
{{InfoBoxBottom}}
| 1.0.0
| February 2021
|[[Axel_Embedded_Linux_Kit_(XELK)#XELK_3.0.01|XELK 3.0.01]] ,
|-
|}
==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. By using the well-known [https://imagemagick.org/ ImageMagick toolsuite], this job can be accomplished straightforwardly. This Application Note (AN) shows how to use it on a system running a XELK-based Yocto Linux distribution.
==Installing <code>fbgrabImageMagick convert</code>==Assuming that root file system provides the [[XELK-AN-003:_Package_Management_with_Yocto|<code>smart</code> tool]]and it is set up properly, the <code>fbgrabImageMagick</code> utility package can be installed as follows:
<pre class="board-terminal">
root@sznpc:~# smart install imagemagick
Loading cache...
Updating cache... ###################################################################################### [100%]
Computing transaction...
 
Installing packages (11):
imagemagick-6.9.2-r0@cortexa9hf_neon libice6-1:1.0.9-r0@cortexa9hf_neon libxau6-1:1.0.8-r0@cortexa9hf_neon libxext6-1:1.3.3-r0@cortexa9hf_neon
lcms-2.7-r0@cortexa9hf_neon libsm6-1:1.2.2-r0@cortexa9hf_neon libxcb1-1.11.1-r0@cortexa9hf_neon libxt6-1:1.1.5-r0@cortexa9hf_neon
libfftw-3.3.4-r0@cortexa9hf_neon libx11-6-1:1.6.3-r0@cortexa9hf_neon libxdmcp6-1:1.1.2-r0@cortexa9hf_neon
 
3.8MB of package files are needed. 8.7MB will be used.
 
Confirm changes? (Y/n): y
 
[ 410.232039] rtc-pcf2127-i2c 1-0051: low voltage detected, check/replace RTC battery.
Fetching packages...
-> http://yocto.dave.eu/xelk-3.0.0/cortexa9hf_neon/libxcb1-1.11.1-r0.cortexa9hf_neon.rpm
-> http://yocto.dave.eu/xelk-3.0.0/cortexa9hf_neon/libice6-1.0.9-r0.cortexa9hf_neon.rpm
libice6-1.0.9-r0.cortexa9hf_neon.rpm ###################################################################################### [ 9%]
libxcb1-1.11.1-r0.cortexa9hf_neon.rpm ###################################################################################### [ 18%]
-> http://yocto.dave.eu/xelk-3.0.0/cortexa9hf_neon/lcms-2.7-r0.cortexa9hf_neon.rpm
-> http://yocto.dave.eu/xelk-3.0.0/cortexa9hf_neon/libsm6-1.2.2-r0.cortexa9hf_neon.rpm
libsm6-1.2.2-r0.cortexa9hf_neon.rpm ###################################################################################### [ 27%]
-> http://yocto.dave.eu/xelk-3.0.0/cortexa9hf_neon/libxt6-1.1.5-r0.cortexa9hf_neon.rpm
libxt6-1.1.5-r0.cortexa9hf_neon.rpm ###################################################################################### [ 36%]
-> http://yocto.dave.eu/xelk-3.0.0/cortexa9hf_neon/libxext6-1.3.3-r0.cortexa9hf_neon.rpm
libxext6-1.3.3-r0.cortexa9hf_neon.rpm ###################################################################################### [ 45%]
-> http://yocto.dave.eu/xelk-3.0.0/cortexa9hf_neon/libxdmcp6-1.1.2-r0.cortexa9hf_neon.rpm
libxdmcp6-1.1.2-r0.cortexa9hf_neon.rpm ###################################################################################### [ 54%]
-> http://yocto.dave.eu/xelk-3.0.0/cortexa9hf_neon/libxau6-1.0.8-r0.cortexa9hf_neon.rpm
libxau6-1.0.8-r0.cortexa9hf_neon.rpm ###################################################################################### [ 63%]
lcms-2.7-r0.cortexa9hf_neon.rpm ###################################################################################### [ 72%]
-> http://yocto.dave.eu/xelk-3.0.0/cortexa9hf_neon/libx11-6-1.6.3-r0.cortexa9hf_neon.rpm
-> http://yocto.dave.eu/xelk-3.0.0/cortexa9hf_neon/libfftw-3.3.4-r0.cortexa9hf_neon.rpm
libfftw-3.3.4-r0.cortexa9hf_neon.rpm ###################################################################################### [ 81%]
libx11-6-1.6.3-r0.cortexa9hf_neon.rpm ###################################################################################### [ 90%]
-> http://yocto.dave.eu/xelk-3.0.0/cortexa9hf_neon/imagemagick-6.9.2-r0.cortexa9hf_neon.rpm
imagemagick-6.9.2-r0.cortexa9hf_neon.rpm ###################################################################################### [100%]
 
Committing transaction...
Preparing... ###################################################################################### [ 0%]
1:Installing libice6 ###################################################################################### [ 9%]
2:Installing lcms ###################################################################################### [ 18%]
3:Installing libxdmcp6 ###################################################################################### [ 27%]
4:Installing libfftw ###################################################################################### [ 36%]
5:Installing libxau6 ###################################################################################### [ 45%]
6:Installing libsm6 ###################################################################################### [ 54%]
7:Installing libxcb1 ###################################################################################### [ 63%]
8:Installing libx11-6 ###################################################################################### [ 72%]
9:Installing libxt6 ###################################################################################### [ 81%]
10:Installing libxext6 ###################################################################################### [ 90%]
11:Installing imagemagick ###################################################################################### [100%]
Output from imagemagick-6.9.2-r0@cortexa9hf_neon:
update-alternatives: Linking /usr/bin/animate to /usr/bin/animate.im6
update-alternatives: Linking /usr/bin/compare to /usr/bin/compare.im6
update-alternatives: Linking /usr/bin/composite to /usr/bin/composite.im6
update-alternatives: Linking /usr/bin/conjure to /usr/bin/conjure.im6
update-alternatives: Linking /usr/bin/convert to /usr/bin/convert.im6
update-alternatives: Linking /usr/bin/display to /usr/bin/display.im6
update-alternatives: Linking /usr/bin/identify to /usr/bin/identify.im6
update-alternatives: Linking /usr/bin/import to /usr/bin/import.im6
update-alternatives: Linking /usr/bin/mogrify to /usr/bin/mogrify.im6
update-alternatives: Linking /usr/bin/montage to /usr/bin/montage.im6
update-alternatives: Linking /usr/bin/stream to /usr/bin/stream.im6
</pre>
</pre>
Then convert the raw data to a PNG image file, run by running the following command:
<pre class="board-terminal">
root@sznpc:~# convert -size 1024x600 -depth 8 rgba:screenshot.raw screen0.png
endmode
</pre>
The numbers following <code>geometry</code> indicate the resolution (1024x600) and the bits required to represent a pixel (32). The last line tells the pixel format (RGBA). 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 8and the format was set to <code>rgba</code>.
8,226
edits