Dear devs,

I'm experiencing an strange issue concerning overviews when I try to add overviews via Python. Essentially I want to create overviews for Greyscale images encoded in RGB, but on one overview level I always get colored pixels in a specific rectangle area of the image.

I created the boiled down test script to demonstrate what I am doing (create RGB grey image of certain size, save it to disk and apply overviews) which is available in the attachment. The script is called like that: `python test_overviews.py out.tif`

In my case I could see the colorfull overviews in QGIS (or MapServer WMS) if I zoomed out a little. A screenshot of QGIS with the image can be found in the attachment.

Strangely, I only have this issue on CentOS 6.3 (gdal 1.9.1, libgeotiff 1.4.0, libtiff 3.9.4) but not on my host Ubuntu 12.10 system (gdal 1.9.2, libgeotiff2 1.3.0, libtiff 4.0.2).

I tried different interpolation methods for the `BuildOverviews` function, with no effect. If I remove the level `2` or `4` from my level list, the effect does *not* show. A different image size results in a different colour and position of the rectangle and sometimes the rectangle is not visible at all.

The issue is the same when I use `gdaladdo out_no_ovr.tif 2 4 8 16`.

Any idea on this?

Regards,
Fabian

<<attachment: screenshot.png>>

import sys
from osgeo import gdal, gdalconst

mem_drv = gdal.GetDriverByName('MEM')
ds = mem_drv.Create('',
                    852, # size X
                    549, # size Y
                    3,   # bands
                    gdalconst.GDT_Byte)

for i in range(1, 4):
    band = ds.GetRasterBand(i)
    band.Fill(128)

driver = gdal.GetDriverByName("GTIFF")
out_ds = driver.CreateCopy(sys.argv[1], ds)

out_ds.BuildOverviews("NEAREST", [
    2,
    4,
    8,
    16
])

ds = None
out_ds = None
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to