Bug report #11129
QgsMapRenderer does not respect DPI
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Python plugins | ||
Affected QGIS version: | master | Regression?: | No |
Operating System: | Ubuntu | Easy fix?: | No |
Pull Request or Patch supplied: | No | Resolution: | end of life |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 19458 |
Description
The dpi parameter is not respected when exporting an image with QgsMapRenderer code below. Same code works with QGIS 1.8 (see attached files). I'm on QGIS master and Ubuntu 12.04/14.04.
img = QImage(QSize(width, height), QImage.Format_ARGB32_Premultiplied) img.setDotsPerMeterX(dpi / 25.4 * 1000) img.setDotsPerMeterY(dpi / 25.4 * 1000) color = QColor(255,255,255) img.fill(color.rgb()) p = QPainter() p.begin(img) p.setRenderHint(QPainter.Antialiasing) render = QgsMapRenderer() render.setLabelingEngine(QgsPalLabeling()) render.setLayerSet(lst) render.setExtent(rect) render.setOutputSize(img.size(), dpi) render.render(p) p.end()
History
#1
Updated by Giovanni Manghi over 7 years ago
- Easy fix? set to No
- Regression? set to No
#2
Updated by Giovanni Manghi over 5 years ago
- Resolution set to end of life
- Status changed from Open to Closed
End of life notice: QGIS 2.18 LTR
Source:
http://blog.qgis.org/2019/03/09/end-of-life-notice-qgis-2-18-ltr/