[Gdal-dev] Gdalwarp resolution

Sampson, David dsampson at NRCan.gc.ca
Thu Nov 23 08:11:08 EST 2006


Could the following message be related to my issue. It would make sense
since the GCP's seem to disapear.

[Gdal-dev] gdal does not write gcp projection

Just a thought

Cheers

 

-----Original Message-----
From: Frank Warmerdam [mailto:warmerdam at pobox.com] 
Sent: November 22, 2006 10:47
To: Sampson, David
Cc: gdal-dev at lists.maptools.org
Subject: Re: [Gdal-dev] Gdalwarp resolution

Sampson, David wrote:
> Hey folks,
> 
> I am trying to move a 800 dpi to a 300 dpi image. The src image was 
> created using gdal_translate to assign SRS, 4 GCP's and change from 
> 16bit to 8bit image. Src image has the following meta_tags
> 
> Metadata:
>   AREA_OR_POINT=Area
>   TIFFTAG_XRESOLUTION=800
>   TIFFTAG_YRESOLUTION=800
>   TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
>   Area_or_Point =Area
> 
> 
> The command line I am using is:
> 
> gdalwarp -tr 300 300 oA38_001.tif S_A38_001.tif
> 
> But I get this error
> 
> Creating output file that is 0P x 0L.
> ERROR 1: Attempt to create 0x0x1 TIFF file, but width, height and 
> bands must be positive.

Dave,

The "dpi printing resolution" information kept in some TIFF files is
completely disconnected from the georeferencing model of GDAL.  So the
-tr flag to gdalwarp is about setting the resolution in the geo
coordinate system of the image, but this image likely has none.

If you just want to downsample the image, you could try:

  gdal_translate -outsize 37.5% 37.5% in.tif out.tif

If you also want to override the resolution metadata tags (possibly
necessary to make printing software print properly) try:

  gdal_translate -outsize 37.5% 37.5% \
      -mo TIFFTAG_XRESOLUTION=300 -mo TIFFTAG_YRESOLUTION=300 \
      in.tif out.tif

Best regards,
-------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam,
warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo,
http://osgeo.org





More information about the Gdal-dev mailing list