'fbgrab output gives blank png

Trying to get screenshot using fbgrab -d /dev/fb0 img0.png but it always outputs a blank image. Am I missing something here?

The captured png has entire range with 255 values as I can see from histogram. histogram of png

Environment:

  • Linux based custom OS built using buildroot running on i.MX6q based embedded custom board.
  • X.org is not enabled.
  • 2 framebuffers(/dev/fb0, /dev/fb1) each being updated by different programs using QT eglfs.
root@hostname:/root# fbgrab -v -z 9 -d /dev/fb0 img0.png
frame buffer fixed info:
id: "DISP3 BG - DI1"
type: packed pixels
line length: 7680 bytes (1920 pixels)

frame buffer variable info:
resolution: 1920x1080
virtual resolution: 1920x4352
offset: 0x3264
bits_per_pixel: 32
grayscale: false
red:   offset: 16, length: 8, msb_right: 0
green: offset: 8, length: 8, msb_right: 0
blue:  offset: 0, length: 8, msb_right: 0
alpha: offset: 24, length: 8, msb_right: 0
pixel format: non-standard
Resolution: 1920x1080 depth 32
Converting image from 32
Now writing PNG file (compression 9)
root@hostname:/root# fbgrab -v -z 9 -d /dev/fb1 img1.png
frame buffer fixed info:
id: "DISP3 FG"
type: packed pixels
line length: 7680 bytes (1920 pixels)

frame buffer variable info:
resolution: 1920x1080
virtual resolution: 1920x1080
offset: 0x0
bits_per_pixel: 32
grayscale: false
red:   offset: 16, length: 8, msb_right: 0
green: offset: 8, length: 8, msb_right: 0
blue:  offset: 0, length: 8, msb_right: 0
alpha: offset: 24, length: 8, msb_right: 0
pixel format: standard
Resolution: 1920x1080 depth 32
Converting image from 32
Now writing PNG file (compression 9)

Tried fbdump using fbdump > grab.ppm the output is different but not close to what is on the screen. I do not have ppmtopng package installed to use fbdump | ppmtopng > grab.png

fbdump output



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source