Global Qt.SmoothTransformation?

26 views
Skip to first unread message

BPT

unread,
May 24, 2020, 2:50:39 PM5/24/20
to pyqtgraph
I am interested in having the effect of Qt.SmoothTransformation for highly zoomed images -- so that they do not look 'pixelated'. Is there some way, such as subclassing imageItem and overloading the paint methods, that this can be done in pyqtgraph? Ideally it would retain the behavior of the mouse "zoom" function when an imageItem is added to a view (viewBox or plotItem).

BPT

unread,
May 25, 2020, 4:31:48 PM5/25/20
to pyqtgraph
This is straightforward for pyqtgraph objects that provide the getViewWidget method.

The getViewWidget method returns a scene object (the first one in a view).

For example, for a plotItem,

self.plot = self.addPlot()
self.viewWidget = self.plot.getViewWidget()
self.viewWidget.setRenderHint(QPainter.SmoothPixmapTransform)

This provides  smooth image interpolation on high levels of zoom and preserves other mouse functions of the view. It has no noticeable performance degradation for user selected images, but would probably be unacceptable for a 'movie' (which is why it is not the default in Qt).
Reply all
Reply to author
Forward
0 new messages