Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

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

    General and Desktop
    2
    3
    58
    Loading More Posts
    • 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
      stephen96 last edited by stephen96

      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 Reply Quote 0
      • M
        mpergand last edited by 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 1 Reply Last reply Reply Quote 2
        • S
          stephen96 @mpergand last edited by stephen96

          @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 Reply Quote 0
          • First post
            Last post