I can manage my own wallpaper on the RPI3 in Raspbian Lite by writing an image directly to the framebuffer with..

convert /path/to/image.jpg -write bgra:/dev/fb0 null:

Running fbset I get the following framebuffer info on the RPI3 for my television connected via HDMI..

mode "1920x1080"
    geometry 1920 1080 1920 1080 32
    timings 0 0 0 0 0 0 0
    rgba 8/16,8/8,8/0,8/24

However, this doesn't work on the RPI4. I get a semblance of the image with distorted greens so I imagine it requires a different format or something.

Running fbset on the same television connected via hdmi I get the following framebuffer info on the RPI4..

mode "3840x2160"
    geometry 3840 2160 3840 2160 16
    timings 0 0 0 0 0 0 0
    accel true
    rgba 5/11,6/5,5/0,0/0

I tried..

convert /path/to/image.jpg -depth 16 -write bgra:/dev/fb0 null:

but similar result.

I was trying different color depths and..

convert /path/to/image.jpg -depth 4 -write bgra:/dev/fb0 null:

gave me the correct sized image on the screen but the colors were all mostly green and distorted.

I've tried using FBI and FIM but they don't allow me to manage my own wallpaper. I can't call FBI with an image and then call it again to change the image.

  • 1
    I believe it is an imagemagick command. Imagemagick is the linux image processing program.
    – deanresin
    May 31, 2021 at 3:04

2 Answers 2


The framebuffer wants an image in the 16 bit RGB565 format. This means 16 bit depth and more precisely 5 bits for Red, 6 for Green, and 5 for Blue. The framebuffer just wants raw data so we have to strip metadata and headers.

convert /path/to/image.jpg\["$fbw"x"$fbh"^\] +flip -strip -define bmp:subtype=RGB565 bmp2:- | tail -c $(( fbw * fbh * fbd / 8 )) > /dev/fb0

Image needs to be flipped or it will be upside down. -strip gets rid of metadata. bmp2:- writes the resultant bmp to standard output where we can retrieve only raw data (ignoring any headers) with tail -c $(( fbw * fbh * fbd / 8 )). We know the color requires 16 bits which is 2 bytes per pixel. If you know the width and height of the framebuffer you know the amount of pixels you need and thus, the amount of bytes of raw data you need to retrieve from the tail of the data.

We can use fbset to get framebuffer width (fbw), framebuffer height (fbh), and framebuffer depth (fbd).

fbw="$(fbset | grep 'geometry' | xargs | cut -d ' ' -f2)"
fbh="$(fbset | grep 'geometry' | xargs | cut -d ' ' -f3)"
fbd="$(fbset | grep 'geometry' | xargs | cut -d ' ' -f6)"

The framebuffer depth will always be 16 bit in this case.


I understand ImageMagic's convert doesn't support RGB565, which is the typical 16-bit framebuffer format. It's possible to perform the conversion with scripts, as the linked thread suggests, but those are not exactly one-liners.

I would rather try to switch to 32-bit framebuffer on your Pi 4, similar to what you had on Pi 3:

 fbset -fb /dev/fb0 -depth 32

There are also framebuffer_depth and framebuffer_ignore_alpha in config.txt that may help, especially if you want the change to be persistent:


PS. It appears that latest versions of ImageMagic do support RGB565, e.g.:

magick logo: -type truecolor -define bmp:subtype=RGB565 logo565.bmp
  • 1
    Unfortunately, I wasn't able to change the framebuffer to 32 bit, either with fbset or permanently in the /boot/config.txt file. Thanks for the link, I will have to investigate that option.
    – deanresin
    Jun 2, 2021 at 18:09
  • @deanresin As suggested here, you may need to remove the dtoverlay=vc4-fkms-v3d line for 32-bit framebuffer to work. Jun 4, 2021 at 15:58
  • 1
    Thanks, I'll test that out. I know that if I reverted to the legacy drivers in raspi-config I got 32 bits but incorrect resolution, I suspect they are related.
    – deanresin
    Jun 4, 2021 at 19:11
  • 1
    I tested it, and as I suspected it was the same as reverting to legacy drivers in raspi-config and wouldn't allow me to change resolution higher than 1920x1280.
    – deanresin
    Jun 6, 2021 at 1:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.