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. Invert colors of B/W image
QtWS25 Last Chance

Invert colors of B/W image

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 4 Posters 6.0k 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.
  • R Offline
    R Offline
    ranshalit
    wrote on last edited by
    #1

    Hello,

    I am using stylesheet for the image (black/white image):
    img: url(:/resource/img.png);
    Is it possible to invert color of image attached to QLable in stylesheet (or any other methods ) ?

    Thanks,
    Ran

    1 Reply Last reply
    0
    • johngodJ Offline
      johngodJ Offline
      johngod
      wrote on last edited by
      #2

      Hi
      I never tryed anything like that, but a quick look at the docs shows http://doc.qt.io/qt-5/qimage.html#invertPixels maybe this can help ?

      1 Reply Last reply
      3
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        To add to @johngod why use a style sheet to put an image in a QLabel ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        R 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          To add to @johngod why use a style sheet to put an image in a QLabel ?

          R Offline
          R Offline
          ranshalit
          wrote on last edited by
          #4

          @SGaist
          Hi,

          Do you mean that pixmap is better for image ?

          Thanks,
          Ran

          mrjjM 1 Reply Last reply
          0
          • R ranshalit

            @SGaist
            Hi,

            Do you mean that pixmap is better for image ?

            Thanks,
            Ran

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @ranshalit
            The QLabel support setting the image directly.
            Even its called setPixmap it does take any image supported by Qt.
            You can even browse the resource and browse to it , directly in Designer.

            1 Reply Last reply
            1

            • Login

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