[gdal-dev] Issue GDAL with JPEG-compressed TIFFS

Peter Hopfgartner peter.hopfgartner at r3-gis.com
Fri Feb 3 06:23:47 EST 2012


I'm doing quite some experiments with GDAL and image compression these days

I do have an issue with geotiff 1.3/gdal 1.8.1 on CentOS 6 with packages 
from ELGIS. The story goes like this:

I create tiffs with

gdal_translate -of GTiff -co COMPRESS=JPEG -co JPEG_QUALITY=90
  -co "TILED=YES" -co "BLOCKXSIZE=512" -co "BLOCKYSIZE=512" <infile> 
<outfile>

and then add overviews with (I do have to add the overlays in distinct 
steps, otherwise gdaladdo aborts with an error message).

gdaladdo --config COMPRESS_OVERVIEW JPEG --config INTERLEAVE_OVERVIEW 
PIXEL --config JPEG_QUALITY_OVERVIEW 90 -r average <outfile> 3
gdaladdo  --config COMPRESS_OVERVIEW JPEG --config INTERLEAVE_OVERVIEW 
PIXEL --config JPEG_QUALITY_OVERVIEW 90 -r average <outfile> 9
gdaladdo --config COMPRESS_OVERVIEW JPEG --config INTERLEAVE_OVERVIEW 
PIXEL --config JPEG_QUALITY_OVERVIEW 90 -r average <outfile> 27
gdaladdo --config COMPRESS_OVERVIEW JPEG --config INTERLEAVE_OVERVIEW 
PIXEL --config JPEG_QUALITY_OVERVIEW 90 -r average <outfile> 81

(Trying with power-of-2-steps gives the same result. If I drop all 
options from gdaladdo: same result).

I'll create a WMS service with MapServer 5.6.7 and do get a big red 
square in the image. The square is "fixed" to the geografical position, 
e.g. if I move the extend the square moves too. The square is situated 
in the corner of the tiff file.
It appears only at some scales. If I change it very slightly, the square 
remqins, if I change for more then approx 1%, it disappears.

I've put the two images at

http://www.r3-gis.com/gdal_issues/tiff_with_jpegcompression_and_overviews.jpeg 
and
http://www.r3-gis.com/gdal_issues/tiff_with_nocompression_and_overviews.jpeg
.

The problem disappears if I do not run gdaladdo on the images or when I 
do not use Jpeg compression:

gdal_translate -of GTiff  -co "TILED=YES" -co "BLOCKXSIZE=512" -co 
"BLOCKYSIZE=512" <origfile> <targetfile>

There are some hits for 
http://www.google.com/search?client=ubuntu&channel=fs&q=mapserver+artefacts+in+raster+gdal&ie=utf-8&oe=utf-8, 
but mostly related to older versions of GDAL and without resolution.


Thanks,

Peter

-- 

Peter Hopfgartner
R3 GIS Srl - GmbH
www.r3-gis.com




More information about the gdal-dev mailing list