Invert colors of B/W image



  • 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



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


  • Lifetime Qt Champion

    Hi,

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



  • @SGaist
    Hi,

    Do you mean that pixmap is better for image ?

    Thanks,
    Ran


  • Qt Champions 2016

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


Log in to reply