2

I have a LZW-compressed GeoTIFF file and would like to split it into several smaller regional files and change the format to png. I tried to do the spliting with gdal_translate -srcwin. I only get a black image. I guess that I first have to deal with the LZW-compression, but I cannot find a way to decompress files.

To compress the file I have the option -co COMPRESS=LZW. But how do I go the other way around. I am very much looking forward to your answers! :)

Here is the command I used:

$ gdal_translate -ot UInt16 -srcwin 6500 3300 1000 1000 input.tif output.tif

$ gdal_translate -of PNG -scale output.tif output.png

This is what gdalinfo says:

$ gdalinfo input.tif
Driver: GTiff/GeoTIFF
Files: EUD_CP-DEMS_2500035000-AA.tif
Size is 40000, 40000
Coordinate System is:
PROJCS["ETRS89 / ETRS-LAEA",
    GEOGCS["ETRS89",
        DATUM["European_Terrestrial_Reference_System_1989",
            SPHEROID["GRS 1980",6378137,298.2572221000027,
                AUTHORITY["EPSG","7019"]],
            AUTHORITY["EPSG","6258"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4258"]],
    PROJECTION["Lambert_Azimuthal_Equal_Area"],
    PARAMETER["latitude_of_center",52],
    PARAMETER["longitude_of_center",10], 
    PARAMETER["false_easting",4321000],
    PARAMETER["false_northing",3210000],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","3035"]]
Origin = (2000000.000000000000000,4000000.000000000000000)
Pixel Size = (25.000000000000000,-25.000000000000000)
Metadata:
  TIFFTAG_DOCUMENTNAME=EUD_CP-DEMS_2500035000-AA.tif
  TIFFTAG_IMAGEDESCRIPTION=File written by egcs_wrgtif 2.1
  TIFFTAG_SOFTWARE=IDL 8.2, Exelis Visual Information Solutions, Inc.
  TIFFTAG_DATETIME=2013:09:17 18:46:37
  TIFFTAG_XRESOLUTION=100
  TIFFTAG_YRESOLUTION=100
  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  ( 2000000.000, 4000000.000) ( 26d54'5.12"W, 53d35'57.62"N)
Lower Left  ( 2000000.000, 3000000.000) ( 20d45'24.21"W, 45d41'42.74"N)
Upper Right ( 3000000.000, 4000000.000) ( 12d15'58.58"W, 57d13'49.19"N)
Lower Right ( 3000000.000, 3000000.000) (  8d 7'39.52"W, 48d38'23.47"N)
Center      ( 2500000.000, 3500000.000) ( 16d56'50.88"W, 51d31'45.31"N)
Band 1 Block=40000x1 Type=Float32, ColorInterp=Gray
6
  • Welcome to gis.SE. Do you mean LZW? If not, can you explain your needs more? Also, can you show the exact command(s) you used.
    – BradHards
    Commented Apr 10, 2014 at 9:51
  • Yes, I mean LZW. Sorry for that!
    – Nizzi
    Commented Apr 10, 2014 at 9:56
  • Please update the question (including the other information I asked for). You can click edit below the question to do this.
    – BradHards
    Commented Apr 10, 2014 at 10:00
  • 1
    have you tried gdal_translate -co COMPRESS=NONE ? Note that I am not sure that the compression is the issue.
    – radouxju
    Commented Apr 10, 2014 at 10:22
  • 1
    You can't say by looking at the image if it is totally black or not, it may only appear like it was. Check the histogram with gdalinfo -hist. It can be that there exist only low values in the original 32-bit image which is quite common.
    – user30184
    Commented May 15, 2014 at 7:34

1 Answer 1

2

I found this question because I had the same need. Since there's no answer and I was able to make this work I've decided to post in case anyone else stumbles upon this.

The solution is pretty simple, that is, if you have GDAL installed. Using the gdal_translate application, one can decompress a GeoTIFF file using the following command:

gdal_translate pathtoinput.tif pathforoutput.tif -co COMPRESS=NONE

Your Answer

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

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