I'm basically making a script to save an image in .png from Qgis with a script and I would like to add a scale bar on it. I'm using this code :
size = self.iface.mapCanvas().size() image = QImage(size, QImage.Format_RGB32) painter = QPainter(image) painter.setRenderHint(QPainter.Antialiasing) settings = self.iface.mapCanvas().mapSettings() layers = settings.layers() settings.setLayers(layers) job = QgsMapRendererCustomPainterJob(settings, painter) job.renderSynchronously() painter.end()
I see that it's possible to do it with a Map Composer, but I had other problems while saving from Map Composer (mainly with the quality of the image output) : https://docs.qgis.org/2.14/en/docs/pyqgis_developer_cookbook/composer.html
Is that possible to add a scale bar on my script ?