Nominate our 2022 Qt Champions!

RGB BGR colors issue on my linux target

  • Hi all,
    I am working on my beaglbone like linux target with QT using linuxfb platform plugin and I have colors issue on my screen.
    Red display as blue on my target. All blue related colors like light-blue and purple display red with variasity.
    Green display OK.
    I have load rainbow of colors using JPG without QT and it's looking good, means that my problem is in QT and probably in my linux-frameBuffer platform plugin.

    in file linuxfbscreen.cpp of the FB plugin code, I have found that it determine the format as RGB888, I also have tried to swap from RGB to BGR using QImage::rgbSwapped() method but nothing display on my screen.

    Can someone give me hint about this issue?

    Best regards,

  • Someone please advice!

  • OK so this is definitely an RGB to BGR issue!!
    I have set 3 colors on one of my pages for RGB colors:
    RED set as (255, 0, 0)
    GREEN set as (0, 255, 0)
    BLUE set as (0, 0, 255)
    On the host (my PC) the colors are OK but on my target the appearance of each one of the above was:
    For (255, 0, 0) I got BLUE - (very bad should be RED)
    For (0, 255, 0) I got green (good)
    For (0, 0, 255) I got RED - (very very bad - should be BLUE)

    Any idea what the hack? :-(

  • Moderators

    Do allow for some time so people can respond. Could you provide some source how you make your calls and how you load your image; everything that'd be related to the issue?

    Kind regards.

  • Lifetime Qt Champion


    To add to @kshegunov, what board is it ? BeagleBone like doesn't provide much information. You graphic device might be in BGR and there's some adjustment to do LinuxFB wise.

  • We are facing the same issue with BeagleBone Black board running Qt 4.8.6 application.
    @IL Have you managed to resolve this issue?

  • Guys, I had the same issue with a SAMA5 board. It turned out to be a difference between QT and linuxfb formats. I edited the fbdevice file in qtcore. There was a bug listed about this issue. I will try and find it and post it again. I made also made an edit for some rotation of the display. After the edit for the swap colors, it still did not work because linux kernel were not reporting things correctly, so I hardcoded the swap of colors.

    Let me know if this is still an issue, then I will find the stuff and post it.

  • @Mikkie

    I am facing a similar issue.

    I fetch frames from linux machine(server) and displaying them on a windows machine(client).

    The image I see in R and B swapped. (I have use QImage to draw image onto a QWidget)

    QImage((uchar*)buffer, widht , height , QImage::Format_RGB888)

    If I dump the contents of the buffer received into a file and open it using Windows Image Viewer I observe the Colors in expected format.

  • i am facing same problem
    how to resolve this