I would like to know how i can select a pixel with a mouse click in an image (QImge) and get pixel position and value.
Thanks
First you have to draw the image. You can do this my making a QLabel
widget and call setPixmap
. You need to convert your QImage
to QPixmap
before doing this (you can use QPixmap.fromImage(img)
).
You can get mouse clicks by subclassing the QImage
and intercepting mousePressEvent
. Look up the pixel value with QImage.pixel()
.