Important: Please read the Qt Code of Conduct -

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

  • 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;
        QLabel lbl;
        QWidget wgt;
        QPixmap pix2;
        QPalette pal;
        pal.setBrush(wgt.backgroundRole(), pix);
        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 is slightly differ:
    alt text
    It's not an illusion, I checked it with macOS tool 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), Qt Creator (Resource View), Google Chrome
    alt text

  • 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.

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

Log in to reply