QT4 How to blur QPixmap image?
I am looking for something like one of the following:
Blur(pixmap);
painter.Blur();
painter.Blur(rect);
Add python code based on @Петър Петров answer for QT 5.
def applyEffectToImage(src, effect):
scene = QGraphicsScene()
item = QGraphicsPixmapItem()
item.setPixmap(QPixmap.fromImage(src))
item.setGraphicsEffect(effect)
scene.addItem(item)
res = QImage(src.size(), QImage.Format_ARGB32)
res.fill(Qt.transparent)
ptr = QPainter(res)
scene.render(ptr, QRectF(), QRectF(0,0, src.width(), src.height()) )
return res
blur = QGraphicsBlurEffect()
blur.setBlurRadius(8)
source = QImage(r"C:\Users\fran\Desktop\test.png")
result = applyEffectToImage(source, blur)
result.save(r"C:\Users\fran\Desktop\result.png")