Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Why same images have different brightness in QtWidgets app and standard Preview app?
QtWS25 Last Chance

Why same images have different brightness in QtWidgets app and standard Preview app?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 223 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    stephen96
    wrote on last edited by stephen96
    #1

    I wrote some code that show two widgets:

    #include <QtWidgets/QApplication>
    #include <QtWidgets/QLabel>
    #include <QtGui/QPixmap>
    
    #include <QtWidgets/QWidget>
    #include <QtGui/QPalette>
    #include <QtGui/QPixmap>
    #include <QtGui/QBrush>
    
    int main(int argc, char** argv)
    {
        QApplication app(argc, argv);
    
        QPixmap pix;
        pix.load(":/mira.jpg");
    
        QLabel lbl;
        lbl.resize(pix.size());
        lbl.setPixmap(pix);
        lbl.show();
    
        QWidget wgt;
        QPixmap pix2;
        pix2.load(":/mira.jpg");
        QPalette pal;
        pal.setBrush(wgt.backgroundRole(), pix);
        wgt.setPalette(pal);
        wgt.setAutoFillBackground(true);
        wgt.resize(pix2.size());
        wgt.show();
    
        return app.exec();
    }
    

    But I noticed that brightness of the image displayed by this widgets and brightness of the same image displayed by standard macOs Preview.app is slightly differ:
    alt text
    It's not an illusion, I checked it with macOS tool DigitalColorimetor.app and brightness is realy differ, thats true!

    Why same images have different brightness in QtWidgets app and standard Preview app? Which image representation is true?

    UPD: I hope that anyone who understands this will be interested in and check that the decoding of jpg images by the Qt library is correct. By the way, Google Chrome displays photos with the same brightness as Preview, and it does not matter which application is in the input focus.

    Obviously Qt does something wrong
    UPD: image opened in (left to right) Preview.app, Qt Creator (Resource View), Google Chrome
    alt text

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mpergand
      wrote on last edited by mpergand
      #2

      I think it's a matter of color space .
      In Preview you can choose a color profil. Have a try with sRGB, it could match because it looks darker.
      Also, in Preview you can know what is the embedded image's profil in the Inspector window.

      S 1 Reply Last reply
      2
      • M mpergand

        I think it's a matter of color space .
        In Preview you can choose a color profil. Have a try with sRGB, it could match because it looks darker.
        Also, in Preview you can know what is the embedded image's profil in the Inspector window.

        S Offline
        S Offline
        stephen96
        wrote on last edited by stephen96
        #3

        @mpergand
        this image opened in Google Chrome has same brightness as in the Preview.app
        I tried to change color schemes on macOS via settings->monitors->colors but difference in brightness is present

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved