[FWTools] problem with compressed TIFF

Emmanuel BELO emmanuel.belo at camptocamp.com
Thu Oct 11 11:37:06 EDT 2007


Dear list,

i try to create internal overviews in compressed TIFFs Files. An error
occurs when using gdaladdo:

ebelo at enchilada:/tmp$ gdaladdo --config COMPRESS_OVERVIEW LZW -r average
test_out.tif 2 4 8 16
0...10...20...30Warning 1: test_out.tif:LZWDecode: Strip -1 not
terminated with EOI code
ERROR 1: test_out.tif:LZWDecode: Not enough data at scanline 0 (short
12108 bytes)
ERROR 1: TIFFReadEncodedTile() failed.
ERROR 1: IReadBlock failed at X offset 0, Y offset 1
ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 1
..Warning 1: test_out.tif:LZWDecode: Strip -1 not terminated with EOI code
ERROR 1: test_out.tif:LZWDecode: Not enough data at scanline 3328 (short
1929 bytes)

My files are originally like this:

ebelo at enchilada:/tmp$ gdalinfo test.tif
Driver: GTiff/GeoTIFF
Files: test.tif
Size is 19811, 15416
Coordinate System is `'
Origin = (798523.321250000037253,90776.398750000007567)
Pixel Size = (0.317500000000000,-0.317500000000000)
Metadata:
  TIFFTAG_IMAGEDESCRIPTION=Image obtenue depuis HPGL
  TIFFTAG_SOFTWARE=SPRING : wtiff.c version 3.3 (26-mai-1998)
  TIFFTAG_XRESOLUTION=400
  TIFFTAG_YRESOLUTION=400
  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
Corner Coordinates:
Upper Left  (  798523.321,   90776.399)
Lower Left  (  798523.321,   85881.819)
Upper Right (  804813.314,   90776.399)
Lower Right (  804813.314,   85881.819)
Center      (  801668.318,   88329.109)
Band 1 Block=256x256 Type=Byte, ColorInterp=Red
Band 2 Block=256x256 Type=Byte, ColorInterp=Green
Band 3 Block=256x256 Type=Byte, ColorInterp=Blue

Which i compress with following command:

ebelo at enchilada:/tmp$ gdal_translate -of GTiff -co "TILED=YES" -co
"COMPRESS=LZW" -co "TFW=YES"  test.tif test_out.tif
Input file size is 19811, 15416
0...10...20...30...40...50...60...70...80...90...100 - done.

It seems to be correct:

ebelo at enchilada:/tmp$ gdalinfo test_out.tif
Driver: GTiff/GeoTIFF
Files: test_out.tif
Size is 19811, 15416
Coordinate System is `'
Origin = (798523.321250000037253,90776.398750000007567)
Pixel Size = (0.317500000000000,-0.317500000000000)
Metadata:
  TIFFTAG_IMAGEDESCRIPTION=Image obtenue depuis HPGL
  TIFFTAG_SOFTWARE=SPRING : wtiff.c version 3.3 (26-mai-1998)
  TIFFTAG_XRESOLUTION=400
  TIFFTAG_YRESOLUTION=400
  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
Image Structure Metadata:
  COMPRESSION=LZW
Corner Coordinates:
Upper Left  (  798523.321,   90776.399)
Lower Left  (  798523.321,   85881.819)
Upper Right (  804813.314,   90776.399)
Lower Right (  804813.314,   85881.819)
Center      (  801668.318,   88329.109)
Band 1 Block=256x256 Type=Byte, ColorInterp=Red
Band 2 Block=256x256 Type=Byte, ColorInterp=Green
Band 3 Block=256x256 Type=Byte, ColorInterp=Blue

Do you have any idea, how to get small TIFFs. In my case, space is more
problematic than speed, then these files will be behind a TileCache server.

It seems that if these files TIFF/LZW don't contain internal overviews,
quality produced by mapserver while zoomed out and using PROCESSING
"RESAMPLE=AVERAGE" command isn't good enough. Should that be?

Best regards,

Emmanuel BELO



-- 
Camptocamp SA
Emmanuel BELO
PSE A
CH-1015 Lausanne

+41 21 619 10 25 (direct)
+41 21 619 10 10 (centrale)
+41 21 619 10 00 (fax)


More information about the FWTools mailing list