[GIS] Remove unwanted white bands when raster layer are overlapping

qgisqgis-2.4raster

In my project when raster layers are overlapping a white band appears the edge of the top layer.

How can I remove it and obtain a seamless overlapping of the raster ?

(I have try to built a vrt with those layers but the with bands remained)

I am working with QGIS 2.4

Here is a example of the phenomena (each layer has 10% transparency)
white band on overlapping raster

Here is the gdalinfo output of one of the raster

Driver: GTiff/GeoTIFF
Files: /vdata/scot_009h_georef.tif
Size is 5985, 2349
Coordinate System is:
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433],
AUTHORITY["EPSG","4326"]]
Origin = (-3.873394354081865,58.119237085214102)
Pixel Size = (0.000601740178426,-0.000601740178426)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
COMPRESSION=LZW
INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left ( -3.8733944, 58.1192371) ( 3d52'24.22"W, 58d 7' 9.25"N)
Lower Left ( -3.8733944, 56.7057494) ( 3d52'24.22"W, 56d42'20.70"N)
Upper Right ( -0.2719794, 58.1192371) ( 0d16'19.13"W, 58d 7' 9.25"N)
Lower Right ( -0.2719794, 56.7057494) ( 0d16'19.13"W, 56d42'20.70"N)
Center ( -2.0726869, 57.4124932) ( 2d 4'21.67"W, 57d24'44.98"N)
Band 1 Block=5985x1 Type=Byte, ColorInterp=Red
NoData Value=0
Band 2 Block=5985x1 Type=Byte, ColorInterp=Green
NoData Value=0
Band 3 Block=5985x1 Type=Byte, ColorInterp=Blue
NoData Value=0

Best Answer

Option 1

You have discovered one option - adding 255 to the "Additional No Value" in Layer Properties/Transparency.

Option 2

Another option is to use a VRT, define 255 as the source nodata value and define 0 as the VRT no data value using gdalbuildvrt.

For example:

gdalbuildvrt -srcnodata 255 -vrtnodata 0 out.vrt in.tif

To do this on all tiffs in a folder, use something like the following (assuming you are using a bash shell on OSX/Linux/Unix based on the path in your gdalinfo output):

for f in *.tif; do gdalbuildvrt -srcnodata 255 -vrtnodata 0 "${f%.*}".vrt "$f";  done

Option 3

A third option that will actually crop the white collars permanently and not turn non-collar white pixels to NoData is the GDAL nearblack utility.

For example:

nearblack -of gtiff -nb 0 -color white -near 0 -o decollar.tif collar.tif

To do this on all tiffs in a folder, use something like the following:

for f in *.tif; do nearblack -of gtiff -nb 0 -color white -near 0 -o "${f%.*}"-decollared.tif "$f";  done

Note "${f%.*}" is bash parameter expansion syntax to get the filename without the extension.