3

I have created a regular route map in QGIS and now I am trying to export it as a PDF using the following settings:

Custom resolution:

Resolution

Scale:

Scale

Size of the element:

Size

Export resolution:

Export resolution

However, after exporting via the top menu option Export as PDF, the outcome has the following resolution, as per Mac file inspector (opening it in Photoshop or Illustrator renders the same proportions:

File inspector size

Can anyone spot what I am doing wrong? I cannot see any other relevant option to change in the Print Composer that could possibly affect the size of my file. Of course, trying to export it as an image throws the same results.

Update: Only exporting to TIFF saves the files at the correct resolution. I still cannot wrap my head around why a PDF reduces hugely the resolution of the output.

Update 20/04/2023: I started a bounty and I am adding a link to download a whole project package. It is not exactly the same files as the original question but the problem remains: trying to export a map from the Print Composer as an A4 at an Export resolution of 300 dpi, so the output would be 2480 x 3508 pixels, it overrides the Export Settings and results in a 595 x 842 pixels PDF file, which basically is the same A4 but at 72 dpi. Weirdly enough, if I export it as a TIFF, it gets the resolution correctly. Any ideas?

Download link here

9
  • 1
    I'm not sure why it would work with a TIFF and not other formats, I tried pretty much the same settings as you and didn't have a problem... but is it worth trying the Layout tab then scrolling down to Resize Layout to Content then press Resize Layout (I don't know the Spanish equivalents...)? And see if that makes a difference somehow?
    – she_weeds
    Dec 8, 2022 at 23:13
  • 1
    You're exporting what? Vector, raster layers? From which source (and, if applicable), in what original resolution?
    – Babel
    Dec 9, 2022 at 15:03
  • @Babel, I am exporting both, raster, SRTM files, at a 10010x10010 pixels resolution) and vector from OSM.
    – Trikelians
    Dec 11, 2022 at 10:04
  • @she_weeds, I tried that and unfortunately the outcome is the same.
    – Trikelians
    Dec 11, 2022 at 10:05
  • 1
    Maybe the error arises from the fact that the size of the map window is given relative to the resolution of the screen (72 dpi). You need to enlarge the size of your map with 4.167 (300/72) when exporting to PDF in 300dpi.
    – christoph
    Apr 23 at 10:31

1 Answer 1

2
+50

I think the pdf you exported are already as you expect, but you are looking at the wrong metrics.

Let me explain: contrary to raster (Tiff) files, PDF files deriving from/including vectors do not have an inherent pixel-resolution. How many pixels you get out of the pdf depends on the settings of the rasterizer you use (GIMP, Photoshop, and any screen-viewer like Acrobat Reader).

From the file you shared I exported a pdf, and queried it with Imagemagick's identify, using first the default rasterizing resolution (72 pixels, shown implicitly and explicitly) and a highr resolution. you can see that at 300 dpi you would get the same pixel size you expect.

This is the same process as importing it in GIMP/Photoshop:

Importing @72dpi:

enter image description here enter image description here

Importing the same file @300dpi:

enter image description here

enter image description here

Importing the same file @900 dpi:

enter image description here

enter image description here

Please keep in mind that these setting do not magically enhance your pdf, they just make a raster out of it with the desired pixel density, but the actual pixel resolution will still be determined by the exporting option.

In the examples above, you can see that the 900dpi file has more pixels, but not more information.

So, for example, using a setting of 3000 dpi will create an image which is 35080x24790 px, but will not yield a better definition than the one @300 dpi, if that is how you exported it.

$ identify karto.pdf
karto.pdf PDF 828x612 828x612+0+0 16-bit sRGB 3691B 0.000u 0:00.000
$ identify -density 72 karto.pdf
karto.pdf PDF 842x595 842x595+0+0 16-bit sRGB 813315B 0.030u 0:00.030
$ identify -density 300 karto.pdf
karto.pdf PDF 3508x2479 3508x2479+0+0 16-bit sRGB 7.6346MiB 0.240u 0:00.247
5
  • 1
    Thanks for the in-depth explanation. I understand your point, but the question remains, unless there's something else I'm missing: if I export in QGIS at 300 dpi, I should get 2480 x 3508 px output. However, I'm still getting the 595 x 842 px output, which "belongs" to an A4 size at 72 dpi.
    – Trikelians
    Apr 24 at 8:58
  • You export from QGIS and you get a pdf file, with no intrinsic pixel size. When you use a viewer like Mac file inspector of Illustrator, they fix the conversion @72 dpi, and only then you get the 595 x 842 px file. Once you open it in Acrobat and zoom into it, which of the screenshot does it resemble in terms of resolution? Apr 24 at 9:22
  • 1
    Opening it in Adobe Photoshop, it shows indeed 300 dpi and the correct horizontal A4 size, also being the image as your second screenshot. Thanks for the help.
    – Trikelians
    Apr 24 at 14:54
  • So this was a non-problem, at the end? Or did you change something in QGIS' settings? If so, please remember to document ias an edit and/or a new answer for those who will face the same issue in the future 😉 Apr 24 at 16:24
  • 1
    I didn't change anything so yeah, after all, it was a non-problem and everything was exporting as it was supposed to be with the settings I used. Most likely, we could say, a misinterpretation from my side of the data in the Mac file inspector.
    – Trikelians
    Apr 24 at 21:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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