5

I have geo-referenced several scanned maps. Theses are placed side by side on separate layers in QGIS. They overlay other older maps of the same areas. Georeferencing caused the maps to have black borders. How can I change these black borders to transparent, or eliminate them, so that the underlying maps' data shows through the gaps in detail between the maps? Here is a screen shot:

enter image description here

  • 1
    During georeferencing you should check Use 0 for transparency when needed. If you don't want/can't repeat georeferencing then you may try to set null data value (transparent color) in the raster properties dialog. The second case may have side affects if the colour selected for transparent/null is used in the image too. – Zoltan Nov 16 '15 at 9:03
  • Assuming you don't want to georeference your scans again, there's an alternative solution to your problem here: gis.stackexchange.com/questions/92458/… – nhopton Nov 16 '15 at 9:27
1

Go to Layer Properties. In the Transparency tab, set the transparency of your borders to 0, which should make the border transparent. You can either add values manually (type them in) or add values from the map using the color picker (click on black border of your raster). As @Zoltan notes, however, this may cause some loss of black pixels in your raster. For future georeferencing, you can do as Zoltan suggests and use 0 for transparency.

Are these tif files? What version of QGIS are you using?

  • The screenshot suggests it's 2.12.0 Lyon. – Techie_Gus Nov 16 '15 at 14:27
  • Many thanks. The rasters were TIFFs georeferenced with QGIS 2.12. to create black and white maps (like the originals). I checked "Use 0 for transparency when needed". I tried setting custom transparency to zero in the transparency tab of properties, but I just lost a lot of map details (as it was black ink). I don't see any tabs for setting border values - how do I find them? I don't mend geo-referencing them again. How do I make a mask? – – Tony Rowlands Nov 16 '15 at 14:39
1

Thanks to all for advice. I have now found a simple workaround for this problem that will eliminate the black borders between adjacent maps and restore the detail lost in the black borders: Make georeferenced rasters as usual, but leave the "Transparency/"No Data Value" box "checked". This will leave lots of drop out in the map detail. Then create a duplicate layer, but this time "uncheck" the "No Data Value Box". Do this for all the adjacent map layers. Group the Unchecked layers together below the grouped checked layers. The Unchecked layers will fill in the missing drop out data from the checked layers and the Checked layers will prevent the black borders from showing through. There is no apparent loss of quality in the finished result.

1

There are three options :

  1. The first one is create a mask then use it in gdalwarp to cut it or add an alpha mask to your raster
  2. The third one is far more complicated. It consists in updating the raster border values to a certains value X the use this value as a nodata value with gdal utilities.
  • Many thanks. The rasters were TIFFs georeferenced with QGIS 2.12. to create black and white maps (like the originals). I checked "Use 0 for transparency when needed". I tried setting custom transparency to zero in the transparency tab of properties, but I just lost a lot of map details (as it was black ink). I don't see any tabs for setting border values - how do I find them? I don't mend geo-referencing them again. How do I make a mask? – Tony Rowlands Nov 16 '15 at 14:32
0

Are these GeoTIFFs or normal tiffs with a .tfw file? I usually use GIMP to do extensive editing on images after georeferencing them. This works no problem if you:

  1. have a world file (.tfw)... I'm not sure if GIMP will retain the geotiff header information when you export the edited image.
  2. DO NOT crop the image... the .tfw file needs the size/extent of the image to remain the same to retain the correct georeferencing information.

But if those two things are under control, using GIMP to edit scanned and georeferenced maps is exceptionally useful.

0

Go to Properties on the raster image; go to the transparency tab; where it says "Transparency band" add bands red, green, and blue with a 100% transparency on them and then click apply.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.