title: PyQt5 Drawing over image with semi transparent color
body: <p>I am trying to draw over image using QPainter. It works good when using solid color. When using semi transparent color, dots were appearing. </p>
  
  <p>Also when drawing multiple lines in one place, the color gets multiplied and produces a darker color. </p>
  
  <pre><code>import sys
  from PyQt5.QtCore import Qt, QPoint
  from PyQt5.QtWidgets import QMainWindow, QApplication
  from PyQt5.QtGui import QPixmap, QPainter, QPen, QColor
  
  
  class Menu(QMainWindow):
  
      def __init__(self):
          super().__init__()
          self.drawing = False
          self.lastPoint = QPoint()
          self.image = QPixmap(r"C:\Users\www\Desktop\image.jpg")
          self.setGeometry(100, 100, 500, 300)
          self.resize(self.image.width(), self.image.height())
          self.show()
  
      def paintEvent(self, event):
          painter = QPainter(self)
          painter.drawPixmap(self.rect(), self.image)
  
      def mousePressEvent(self, event):
          if event.button() == Qt.LeftButton:
              self.drawing = True
              self.lastPoint = event.pos()
  
      def mouseMoveEvent(self, event):
          if event.buttons() and Qt.LeftButton and self.drawing:
              painter = QPainter(self.image)
              painter.setPen(QPen(QColor(121,252,50,50), 20, Qt.SolidLine))
              painter.drawLine(self.lastPoint, event.pos())
              self.lastPoint = event.pos()
              self.update()
  
      def mouseReleaseEvent(self, event):
          if event.button == Qt.LeftButton:
              self.drawing = False
  
  
  if __name__ == '__main__':
      app = QApplication(sys.argv)
      mainMenu = Menu()
      sys.exit(app.exec_())
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/GZzTY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GZzTY.png" alt="enter image description here"></a></p>
  
  <p>I need to keep the color as the original color(instead of getting darker each time) when drawing several times over the same place.</p>