[gdal-dev] convert USGS Topo GeoPDF to GeoTiff, file size

Even Rouault even.rouault at mines-paris.org
Sat Aug 2 12:52:56 PDT 2014


Le jeudi 31 juillet 2014 16:46:36, Liu, Jian a écrit :
> Hello,
> 
> I try to use GDAL to convert USGS Topo geopdfs to Geotiff format. I have
> the following command:
> 
> gdalwarp geo.pdf geo.tif -crop_to_cutline -cutline
> C:\JIANTestFolder\cutline.csv -overwrite --config GDAL_CACHEMAX 500 -wm
> 500 --config GDAL_PDF_LAYERS_OFF Projection_and_Grids --config
> GDAL_PDF_DPI 508 -co "TILED=YES" -co "TFW=YES" -co "COMPRESS=JPEG" -co
> "PHOTOMETRIC=YCBCR"
> 
> I want to maintain the image quality while keeping the file to a minimal
> size. But my output .tif is about twice as big as the input pdf (19.5M vs.
> 11.9M)  -- the output dpi (GDAL_PDF_DPI=508) is set based on the metadata
> information in the geopdf. I read somewhere that pdf just stores image "as
> it is", and I am wondering how come my geotiff is twice as big, even with
> the jpeg compression with the YCBCR option? Is it still possible to reduce
> its size?
> 
> Here is the geopdf I use:   
> http://ims.er.usgs.gov/gda_services/download?item_id=5998960
> 
> I've searched the mail archive and couldn't find anything relevant. I
> appreciate any answers or suggestions about converting geopdf to geotiffs.
> Thank you!

Jian,

when using gdalwarp, you go through several abstraction layers that "loose" 
the original compressed format.

With additionnal developments, it might be possible to have a script/program 
that would :
1) extract the JPEG files from the PDF, identically to how they are stored in 
the PDF
2) do the cropping by preserving the tiles completely within the cutline, and 
cropping the ones intersecting it
3) reassembling the whole as a TIFF with JPEG compression, provided they all 
use the same JPEG quantization tables

This would be a non-trivial development effort.

You can refer to one of my somehow related blog post : 
http://erouault.blogspot.fr/2014/04/advanced-jpeg-in-tiff-uses-in-gdal.html ( 
the end particularly)

Best regards,

Even

> 
> Best regards,
> Jian

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list