ArgentoSapiens
ArgentoSapiens

Reputation: 428

How can anti-aliasing be enabled in a pyqtgraph ImageView?

I'm using pyqtgraph's ImageView widget to display an image that needs to be scaled up by a factor of 1.25 to 1.5 to be comfortably viewed. This makes the nearest-neighbor sampling of the image obvious and distracting. The setAutoDownsample method on the ImageItem instance inside of the ImageView instance helps when a large image is scaled very small. But how can I enable anti-aliasing to improve the appearance of a small image that's being scaled up?

I have tried calling the setAntialiasing method of the GraphicsView instance inside the ImageView instance, but this has no effect. It may be due to the note in the documentation:

Note that this will only affect items that do not specify their own antialiasing options.

But I cannot understand what items in the GraphicsView might have their own options, or how to change these.

Upvotes: 1

Views: 3585

Answers (1)

Aorus
Aorus

Reputation: 138

I ran into a similar issue and found that enabling antialising globally did the trick:

import pyqtgraph as pg
pg.setConfigOptions(antialias=True)

Upvotes: 3

Related Questions