Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Modify an image based on slider position PyQT5



  • How to modify an image based on slider in PyQT5 and QML? Should I use QQuickImageProvider and QImage? How do I change the pixels in an image according to the slider vales?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    What exact operation do you want to do ?



  • @SGaist Okay I want noise to be added to an image and the amount of noise added to the image has to be determined by the position of the slider. I have already made the slider in the UI and I have made a python function that uses numpy and opencv to add noise. I just don't know how to combine these both. I saw the signals and slots mechanism as well, but there are not many example for image and slider in qml.
    I am sorry if this seems basic, I am a little new to PyQT5 and qml.



  • @SGaist Should I attach the code of the python noise function and the slider I have till now? There is also a problem with the slider as well, the stepsize is 0.10 on a range from 0 to 1 and the snapmode is on, but somehow the text shown on the UI is 0.600000001 and 0.30000001 instead of 0.6 and 0.3 respectively. This is not the case for 0.2, 0.1 or any other number from 0 to 1. I should open a different thread for this right?
    I'd really appreciate any help at all.


  • Lifetime Qt Champion

    Did you consider using the QtGraphicalEffects module ?