[Qgis-user] Geo Raster Background

L.W. eaglelw at gmx.de
Fri Oct 1 02:30:15 PDT 2021


I think one of us is on the wrong track with what is to be achieved.

I don't want to manipulate the image itself, just the background at the
moment when the raster image (or raster pdf) is converted to a TIF and
georeferenced.

if the rectangle contains black text, as described, this would also be
manipulated after the described manipulation, that's not what I want.

Thank you for your efforts.


Am 01.10.2021 um 10:49 schrieb Charles Dixon-Paver:
> You can translate pixel values with the raster calculator (available
> under the raster menu). Black pixels will have a value of 0,0,0 on RGB
> bands and red pixels would have a value of 255,0,0 so it's just a
> matter of changing the values accordingly on those bands.
>
> The raster calculator will contain an if expression in the next QGIS
> release, but if you're using an existing release you will have to use
> a bit of a quirky syntax to achieve that.
>
> So if you select the red band and use an expression similar to (
> "Image at 1" =  0 )  *  255 it should work. If you need assistance on
> raster calculator syntax gis stack overflow has a large number of Q&A
> on the topic.
>
> If you need info on a particular pixel value at each band, just use
> the identify features tool (it works on rasters too).
>
> Note that the previous statement about the GIS identifying valid data
> values from background pixel values still applies to the calculator.
>
>
> On Fri, 1 Oct 2021 at 10:36, L.W. <eaglelw at gmx.de
> <mailto:eaglelw at gmx.de>> wrote:
>
>     Thanks for answering, but I think this is not the way I want to go ...
>
>     Or, I do not have written detailed.
>
>     I have a raster image e.g. a white rectangle, after setting the
>     points, QGIS rotats this image, let's say, by 45 degrees.
>
>     The corners of the imported image are now black triangles.
>
>     I do want to have e.g. red triangles ...
>
>     Regards
>
>
>     Am 01.10.2021 um 09:50 schrieb Charles Dixon-Paver:
>>     There's not really any way for a GIS system to automatically
>>     differentiate between black background pixels and black data
>>     pixels. QGIS supports users setting custom pixel values to render
>>     as transparent pixels, but it's left up to users to ensure that
>>     their data and background values are different.
>>
>>     From my view, there are a couple of options when it comes to
>>     fixing this issue in your data. One is to use an image processing
>>     tool like GIMP or Photoshop effectively, but that requires
>>     retaining the geographic information and knowing how to reprocess
>>     the raster accordingly.
>>
>>     The simplest solution I'm aware of is probably to follow this
>>     workflow in QGIS:
>>
>>       * Start a new QGIS project
>>       * Set all black pixels to transparent in the transparency tab
>>         of the raster layer properties
>>       * Digitize a "bounding area" - you can do this with a memory layer
>>       * Move your vector layer to render underneath the raster
>>       * Give the vector a simple black symbology
>>       * Use the "Convert map to raster" tool from the processing toolbox
>>
>>     There are a wide number of variations on that workflow that are
>>     possible of course, but I think that's the easiest to get started.
>>
>>     Regards
>>
>>
>>
>>     On Fri, 1 Oct 2021 at 09:28, L.W. <eaglelw at gmx.de
>>     <mailto:eaglelw at gmx.de>> wrote:
>>
>>         Hi,
>>
>>         how to change the backgroundcolor of a georeferenzed raster
>>         image?
>>
>>         When a raster image is rotated by qgis after setting all
>>         points the
>>         backgroundcolor is black RGB(0,0,0).
>>
>>         Set black to transparent is difficult when there is black text.
>>
>>         regards
>>
>>         _______________________________________________
>>         Qgis-user mailing list
>>         Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>
>>         List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>         <https://lists.osgeo.org/mailman/listinfo/qgis-user>
>>         Unsubscribe:
>>         https://lists.osgeo.org/mailman/listinfo/qgis-user
>>         <https://lists.osgeo.org/mailman/listinfo/qgis-user>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20211001/bbf088d1/attachment-0001.html>


More information about the Qgis-user mailing list