[gdal-dev] Regarding DPI in Geospatial PDF

Jukka Rahkonen jukka.rahkonen at maanmittauslaitos.fi
Mon May 11 02:50:39 PDT 2015


Vankadara, Sunil <sunil.vankadara <at> hexagongeospatial.com> writes:

> 
> Hi Team,
> 
> I have created two PDF file with default DPI and 600 values using
gdal_translate application.
> Unfortunately I couldn't find any difference among these two created files
like file size, pixel size etc.
> 
> The input file details are
> Input file type: Erdas . img file
> Width of the image: 11938
> Height of the image:: 14184
> Datatype: UINT 8
> No of Bands: 3
> 
> May I know the reason for not showing up the difference in created outputs?
> 
> Regards
> Sunil
> 

Hi,

It may be that DPI setting at the moment does not have a totally desired
effect. It would feel natural that increasing DPI from the default value 72
into a bigger value like 300 would make the page size of the PDF smaller
expressed as physical units like millimeters.

The DPI setting is not supposed to affect the image itself so the PDF file
size will be the same as well as the image quality so no up/downsampling
will occur.

You can read some background from http://trac.osgeo.org/gdal/ticket/5412. In
older PDF versions there was an absolute limit that page could not be bigger
than 14000 units and the unit size was fixed to 1/72 inch. This limitation
can be overridden in later PDF versions by using a UserUnit.

Create some sample PDF files with gdal_translate and you can see how the
user unit behaves by opening the PDF file with a text editor and having a
look at row 4 in the file.

Without -co DPI

<< /Annots 6 0 R /Contents 4 0 R /MediaBox [ 0 0 1728 1977 ] /Parent 1 0 R
/Resources 5 0 R /Type /Page /UserUnit 1 >>

With -co DPI=300

<< /Annots 6 0 R /Contents 4 0 R /MediaBox [ 0 0 414.72000000000008
474.48000000000008 ] /Parent 1 0 R /Resources 5 0 R /Type /Page /UserUnit
4.1666666666666661 >>

With -co DPI=600 

<< /Annots 6 0 R /Contents 4 0 R /MediaBox [ 0 0 207.36000000000004
237.24000000000004 ] /Parent 1 0 R /Resources 5 0 R /Type /Page /UserUnit
8.3333333333333321 >>


The image box sixe comes from (MediaBox size) x (UserUnit size) and remains
the same in all three cases because GDAL is adjusting both the MediaBox and
UserUnit hand in hand.

It could be that GDAL should not touch to the size of the MediaBox if it
does not exceed 14400 in either dimension.

-Jukka Rahkonen-



More information about the gdal-dev mailing list