5

The starting point: Loading a raster to QGIS, you can set individual colors to transparent in the Panel Layer styling / Tab Transparency by activating the icon Add values from display and click on the map canvas. The color of the selected raster pixel will be set to transparent (see screenshot below).

The problem and what I tried: As can be seen in the screenshot, often (especially using georeferenced jpg-images) what for the eye is one color, technically consists of several different colors with very similar values for red/green/blue: different shades of the same color. Of course, you could repeatedly use the Add values from display and click on the map to add further colors to the transparency setting.

The question: However, this can be annoying. Is there a way to select a range of colors to be set to transparent? I'm looking for something like tools known from image processing software like Photoshop or Affinity Photo, e.g. the Flood Select Tool in Affinity Photo: Tolerance—sets the range of pixels affected when a pixel is clicked.

Screenshot: Only part of the see is set to transparent (RGB value: 221/242/247), showing the OpenStreetMap basemap in the background. Neighboring pixels with - let's say - RGB 225/240/243 are still opaque:

enter image description here

1 Answer 1

2

Problem:

Even if you could set a tolerance, you wouldn't get all of the sea, and you would still have text in the sea ('Mittelsee' etc).

Possible Solution

You might be better served by using a vector coastline map to select and copy only the areas of the georeferenced raster that you want to keep. Put it in a separate raster. Remove the original raster. This will also tell you if your georeferencing was good.

Use gdalwarp to perform the clipping. It will create a new raster. Load it in QGIS. Copy the style of your original raster and paste it to the new raster if necessary.

You may need to put a small buffer on the coastline so you don't have sharp edges.

Finally, put your own water layer underneath using bathymetry data, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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