Bug report #18132

Dpi resolution of images exported from composer is wrong

Added by Andrea Giudiceandrea almost 7 years ago. Updated over 6 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Map Composer/Printing
Affected QGIS version:2.18.17 Regression?:Yes
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:26025

Description

QGIS 2.18.16 64 bit (standalone installer) on Windows 7 SP1 64 bit

When using "Export as Image..." tool from map / print composer, with, for example:
"Page size" = A4 (210x297mm)
"Export resolution" = 150 dpi,

the "Image export options" window is automatically filled with:
"Export resolution" = 150 dpi
"Page width" = 1240 px
"Page eight" = 1753 px

but the exported image (BMP/PNG/JPEG/JPG/TIF/TIFF formats) will be 1240x1753 px with the wrong resolution set to 149 dpi; so it will be of the incorrect size of 211,38x298,83 mm.

The same for, e.g., 300 dpi: the exported image will have the wrong resolution of 299 dpi.

History

#1 Updated by Andrea Giudiceandrea over 6 years ago

The bug is also occurring in 2.18.17

#2 Updated by Giovanni Manghi over 6 years ago

  • Status changed from Open to Feedback
  • Affected QGIS version changed from 2.18.16 to 2.18.17

Andrea Giudiceandrea wrote:

The bug is also occurring in 2.18.17

please test also QGIS 3, thanks!

#3 Updated by salvatore fiandaca over 6 years ago

I confirm the problem for 2.18.17.
test on QGIS3.0:
A4 150 dpi
exporting I get correct values ie 150 dpi

#4 Updated by Andrea Giudiceandrea over 6 years ago

Further investigating...
I tested some previous versions: 1.8.0, 1.9.0, 2.0.1, 2.10.1 aren't affected; 2.12.0, 2.14.22, 2.16.3 are affected.
So it seems the bug was introduced in 2.12.

#5 Updated by Giovanni Manghi over 6 years ago

  • Priority changed from Normal to High
  • Regression? changed from No to Yes

#6 Updated by Andrea Giudiceandrea over 6 years ago

I've probably found the commit that introduced the bug:

[composer] Fix image size/resolution was not honored during export (fix #13438)
e553a792561da4a1d5d30040808343e5337eec0b
nyalldawson committed on 4 Oct 2015

#7 Updated by Andrea Giudiceandrea over 6 years ago

Pull request with commit that fixes the bug: https://github.com/qgis/QGIS/pull/6524

#8 Updated by Giovanni Manghi over 6 years ago

  • Operating System deleted (Windows 7 SP1 64 bit)
  • Pull Request or Patch supplied changed from No to Yes

#9 Updated by Giovanni Manghi over 6 years ago

  • Status changed from Feedback to Open

#10 Updated by Andrea Giudiceandrea over 6 years ago

Pull request https://github.com/qgis/QGIS/pull/6524 with commit that fixes the bug
Applied in changeset qgis|4f05da4a0de9e2c17b6e47bed36e7aca1c6d125d.

#11 Updated by Nyall Dawson over 6 years ago

  • Resolution set to fixed/implemented
  • Status changed from Open to Closed

Also available in: Atom PDF