[gdal-dev] Making non-rectangular image edges transparent

Just van den Broecke justb4 at gmail.com
Mon Nov 29 06:07:31 EST 2010


Hi,

I am looking for a commandline recipe with gdal_translate/gdalwarp to 
create transparent areas as edges of (historic) rastermaps. The 
situation is as follows:

- (800) source PNG images, samples: http://kademo.nl/public/histmap
- each image is georeferenced (4 corners of visible area)
- visible area is non-rectangular (parallelogram)
- there are constant pixel offsets (19 and 26) for the visible area
- non-visible area is black but black appears also in visible area
- there are (4) triangular side areas that need to become transparent
- the end result should be GeoTIFFs (or other format for WMS)

Georeferencing is not the issue, only making the triangular edges 
transparent using a (Unix) commandline chain.
I have consulted many sources like 
http://linfiniti.com/2010/11/raster-masks-in-qgisfossgis but somehow 
these didn't fit the issue completely. I have tried/thought of several 
solutions:

- using ImageMagick to create a transparent mask
- creating a Shape for the (non)visible area
- using gdalwarp with a pixel cutline
- using gdal to create VRT files and add alpha channels

Any help/links appreciated. best regards,

Just van den Broecke
www.justobjects.nl
The Netherlands


More information about the gdal-dev mailing list