Opened 13 years ago

Closed 13 years ago

#3821 closed defect (fixed)

gdal_retile.py handles alpha incorrectly (patch)

Reported by: cdestigter Owned by: warmerdam
Priority: normal Milestone: 1.8.0
Component: Utilities Version: svn-trunk
Severity: normal Keywords:
Cc:

Description

gdal_retile.py doesn't handle alpha channels properly. This results in semi-transparent black shadows when resampling input images. The black borders are more obvious in highly shrunk (ie from high res to low res) output.

EvenR helped me out with the attached patch, which fixes the problem by setting band interpretation correctly in gdal_retile.py, and using it in GDALReprojectImage.

Here's my command line:

rm -r ~/tmp/retiled
mkdir ~/tmp/retiled
gdal_retile.py -v -co ALPHA=YES -ps 4096 4096 -ot Byte -r bilinear -levels 4 -targetDir ~/tmp/retiled ~/tmp/src-images/0000000*.tif

I'll also attach some tiny RGBA test tiffs which demonstrate the problem. Compare the output in levels 3 and 4 of output before and after patching.

Attachments (2)

gdal-retile-alpha-fix.patch (2.5 KB ) - added by cdestigter 13 years ago.
gdal-retile-borders-test.zip (922.0 KB ) - added by cdestigter 13 years ago.

Download all attachments as: .zip

Change History (3)

by cdestigter, 13 years ago

Attachment: gdal-retile-alpha-fix.patch added

by cdestigter, 13 years ago

comment:1 by Even Rouault, 13 years ago

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

r21095 /trunk/gdal/alg/gdalwarper.cpp: GDALReprojectImage() : correctly assign nSrcAlphaBand and nDstAlphaBand (#3821)

r21096 /trunk/gdal/swig/python/scripts/gdal_retile.py: gdal_retile.py : assign color interpretation (#3821)

r21097 /trunk/autotest/ (gcore/data/rgba.tif pyscripts/test_gdal_retile.py): Test gdal_retile.py with RGBA dataset (#3821)

Note: See TracTickets for help on using tickets.