10

enter image description hereI have looked at solutions to what seem to be somewhat similar problems but they don't seem to solve my problem. A georeferenced raster layer loads into the correct location in relation to other layers, so CRS is obviously OK, but has this black background which I don't know how to remove.

enter image description here

7
  • 2
    Just click on the black area with the information tool, and add the reported value as additional nodata in the layers properties, Transparency tab.
    – AndreJ
    Apr 4 '17 at 5:37
  • Is the information tool the Identify Features tool? I have tried that but nothing seems to happen when I click on the layer.
    – Bill C
    Apr 4 '17 at 11:40
  • Yes, the white i in the blue circle. You have to select the raster layer first, then click within the black triangles.
    – AndreJ
    Apr 4 '17 at 17:14
  • Have done that as described including layer selection, Andre, and I get a message at the bottom left of the screen "No features at this position found."
    – Bill C
    Apr 4 '17 at 20:34
  • Sorry, Andre, I had the wrong layer selected.Will try again.
    – Bill C
    Apr 4 '17 at 20:35
7

1. Method

To remove the black border temporarily in QGIS, you can set the "Additional no data value" in Layer properties -> Transparency to 0 (or 000000). If the border is not 100% black you can use the information tool to find out which color you need to set to transparent. If the border is not evenly black, you can use the custom transparent pixel list in the same window below.

Additional No Data Value

2. Method

If you like to permanently remove the black border in your image by adding an alpha channel, you can use the GDAL Tool nearblack: Go to Raster -> Analysis -> Near Black and set the in- and ouputfile, then use the edit pen to add -setalpha and -of GTiff.

nearblack -of GTiff -setalpha -o output.tif input.tif

Near Black

(Of course you need to set output.tif and input.tif to your needs)

2
  • I have tried your "-setalpha" Near Black process. The process runs using my input and output files but just keeps returning the same black background? Do you know why this may be?
    – Ben
    Apr 4 '17 at 23:30
  • I tried and it didn't work for me too, raising a warning about Formats. But it works when the output format (-of) is specified. I updated the answer accordingly. Please try this :-)
    – pLumo
    Apr 5 '17 at 6:03
1

[![][1]][1]

Add the None band and set the RGB values to 0-0-0, Certainly the black background goes. https://i.stack.imgur.com/xD94j.png

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.