[Qgis-developer] mapRenderer.render(imagePainter)
Geo DrinX
geodrinx at gmail.com
Fri Sep 26 08:08:48 PDT 2014
Hello,
I noticed that using the .render() function with pyQgis > 2.2
the labels are not visible.
This is my test source code :
iface = qgis.utils.iface
mapRenderer = mapCanvas.mapRenderer()
mapRect = mapRenderer.extent()
width = mapRenderer.width()
height = mapRenderer.height()
srs = mapRenderer.destinationCrs()
# create output image and initialize it
image = QImage(QSize(width, height), QImage.Format_ARGB32)
image.fill(0)
#adjust map canvas (renderer) to the image size and render
imagePainter = QPainter(image)
zoom = 1
target_dpi = int(round(zoom * mapRenderer.outputDpi()))
mapRenderer.setOutputSize(QSize(width, height), target_dpi)
mapRenderer.render(imagePainter)
imagePainter.end()
xN = mapRect.xMinimum()
yN = mapRect.yMinimum()
nomePNG = ("TestImage")
input_file = out_folder + "/" + nomePNG + ".png"
image.save(input_file, "png")
Somebody can test it and confirm ? Perhaps , it was introduced some
other parameter for the labels , from 2.4 version ?
Thank you in advance
Roberto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20140926/c0ade2fc/attachment.html>
More information about the Qgis-developer
mailing list