4

How can I set the zoomedInResampler of a Raster Layer to Cubic and the zoomedOutResampler to Average using PyQGIS?

2

1 Answer 1

6

Ok, looking deeper into the API helped:

rasterLayer = iface.activeLayer()
resampleFilter = rasterLayer.resampleFilter()
resampleFilter.setZoomedInResampler(QgsCubicRasterResampler())
resampleFilter.setZoomedOutResampler(QgsBilinearRasterResampler())
1
  • 2
    Took me a while to figure out but if you would like to disable resampling (nearest neighbour) its: resampleFilter.setZoomedOutResampler(None) Mar 4, 2021 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.