Opened 14 years ago

Closed 14 years ago

#3720 closed defect (fixed)

geotiff files created by gdal_translate sometimes missing origin and pixel size

Reported by: sgrewe Owned by: warmerdam
Priority: normal Milestone: 1.8.0
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords:
Cc:

Description

I am trying to translate .png files to geotiff files with gdal_translate, assigning the georeferenced bounds of the output file with the -a_ullr ulx uly lrx lry option. Sometimes this is working, but when the uly coordinate specified in -a_ullr is 0, it is not working.

this is not working (in the output file 0.tif there is no origin, no pixel size, wrong sign of the y corner coordinates and center):

gdal_translate -of GTiff -a_ullr 0 0 256 -256 0.png 0.tif

gdalinfo 0.png Driver: PNG/Portable Network Graphics Files: 0.png Size is 256, 256 Coordinate System is `' Image Structure Metadata:

INTERLEAVE=PIXEL

Corner Coordinates: Upper Left ( 0.0, 0.0) Lower Left ( 0.0, 256.0) Upper Right ( 256.0, 0.0) Lower Right ( 256.0, 256.0) Center ( 128.0, 128.0) Band 1 Block=256x1 Type=Byte, ColorInterp=Red Band 2 Block=256x1 Type=Byte, ColorInterp=Green Band 3 Block=256x1 Type=Byte, ColorInterp=Blue

gdalinfo 0.tif Driver: GTiff/GeoTIFF Files: 0.tif Size is 256, 256 Coordinate System is `' Image Structure Metadata:

INTERLEAVE=PIXEL

Corner Coordinates: Upper Left ( 0.0, 0.0) Lower Left ( 0.0, 256.0) Upper Right ( 256.0, 0.0) Lower Right ( 256.0, 256.0) Center ( 128.0, 128.0) Band 1 Block=256x10 Type=Byte, ColorInterp=Red Band 2 Block=256x10 Type=Byte, ColorInterp=Green Band 3 Block=256x10 Type=Byte, ColorInterp=Blue

but this is working:

gdal_translate -of GTiff -a_ullr 0 -256 256 -512 1.png 1.tif

1.png Size is 256, 256 Coordinate System is `' Image Structure Metadata:

INTERLEAVE=PIXEL

Corner Coordinates: Upper Left ( 0.0, 0.0) Lower Left ( 0.0, 256.0) Upper Right ( 256.0, 0.0) Lower Right ( 256.0, 256.0) Center ( 128.0, 128.0) Band 1 Block=256x1 Type=Byte, ColorInterp=Red Band 2 Block=256x1 Type=Byte, ColorInterp=Green Band 3 Block=256x1 Type=Byte, ColorInterp=Blue

gdalinfo 1.tif Driver: GTiff/GeoTIFF Files: 1.tif Size is 256, 256 Coordinate System is `' Origin = (0.000000000000000,-256.000000000000000) Pixel Size = (1.000000000000000,-1.000000000000000) Image Structure Metadata:

INTERLEAVE=PIXEL

Corner Coordinates: Upper Left ( 0.000, -256.000) Lower Left ( 0.000, -512.000) Upper Right ( 256.000, -256.000) Lower Right ( 256.000, -512.000) Center ( 128.000, -384.000) Band 1 Block=256x10 Type=Byte, ColorInterp=Red Band 2 Block=256x10 Type=Byte, ColorInterp=Green Band 3 Block=256x10 Type=Byte, ColorInterp=Blue

Regards, Stefan Grewe

Attachments (4)

0.png (2.2 KB ) - added by sgrewe 14 years ago.
0.tif (192.4 KB ) - added by sgrewe 14 years ago.
1.png (35.0 KB ) - added by sgrewe 14 years ago.
1.tif (192.5 KB ) - added by sgrewe 14 years ago.

Download all attachments as: .zip

Change History (5)

by sgrewe, 14 years ago

Attachment: 0.png added

by sgrewe, 14 years ago

Attachment: 0.tif added

by sgrewe, 14 years ago

Attachment: 1.png added

by sgrewe, 14 years ago

Attachment: 1.tif added

comment:1 by Even Rouault, 14 years ago

Component: defaultGDAL_Raster
Milestone: 1.8.0
Resolution: fixed
Status: newclosed

Fixed in trunk (r20294)

Note: See TracTickets for help on using tickets.