[Qgis-user] background transparency

Richard McDonnell richard.mcdonnell at opw.ie
Thu Aug 17 09:04:54 PDT 2017


Brett,
There appears to be nothing wrong with those examples, if there where, 
you would be informed anyway!
Another approach try this /*gdal_calc.py -A input.tif 
--outfile=result.tif --calc="A*(A>0)" --NoDataValue=0
*/This supposes of course, you are familiar with command line GDAL!

Might I suggest another solution, It will only work with other QGIS 
users, but If you, in Properties, save your style as default, it will 
create a default qgis style with the same name as the raster. When you 
send it along with the raster, or anyone opens the raster, where the 
style is in the same location, the raster will always open as you require.
Without having a subset of your dataset to play with Im sorry, I cant be 
of any more help!!
Regards,

Richard.



On 16/08/2017 03:32, Brett Adams wrote:
>
> Hi Richard,
>
> Trialled your suggestion and others contained in the 
> gis.stackexchange.com link.    Always get the same result where if any 
> of the three bands contain a 0, it’s removed.
>
> Maybe I’ve got the syntax slightly wrong?
>
> *Original *
>
> gdalwarp -overwrite -s_srs EPSG:28351 ""C:/Brett.tif"
>
> *Trialled variations*
>
> gdalwarp -overwrite -srcnodata "0,0,0" -dstnodata "0,0,0" -s_srs 
> EPSG:28351 -of GTiff "C:/Brett.tif" "C:/Brett2.tif"
>
> gdalwarp -overwrite -srcnodata "0,0,0" -dstnodata "0,0,0" -of GTiff 
> "C:/Brett.tif" "C:/Brett2.tif"
>
> gdalwarp -overwrite -srcnodata None -dstnodata None -dstalpha -s_srs 
> EPSG:28351 -of GTiff "C:/Brett.tif" "C:/Brett2.tif"
>
> Brett
>
> *From:*Richard McDonnell [mailto:richard.mcdonnell at opw.ie]
> *Sent:* Tuesday, 15 August 2017 11:17 PM
> *To:* Brett Adams; qgis-user at lists.osgeo.org
> *Subject:* Re: [Qgis-user] background transparency
>
> Hi,
> Just looking into this, but you might try whats outlined here
>
> https://gis.stackexchange.com/questions/166699/replacing-rgb-value-0-0-0-with-nodata-nodata-nodata-in-gdal
>
> Warp, can be found under *Raster*, *Projections*,*Warp *fill in the 
> fields just as you done before for the Translate, with the exception 
> of the nodata field.
>
> At the bottom where you see the GDAL script being constructed, you 
> should also see a Pencil or Pen icon, select this, it will allow you 
> to directly edit the script.
> You should paste */-srcnodata "0,0,0" -dstnodata "0,0,0" /*just 
> after*/-overwrite /*so as you have something like below*/.
>
> /*gdalwarp -overwrite -srcnodata "0,0,0" -dstnodata "0,0,0" -of GTiff 
> raster_in.tif raster_out.tif
>
> Hope this helps.
>
> Regards,
>
> Richard.
>
>
>
> On 15/08/2017 13:42, Brett Adams wrote:
>
>     Richard,
>
>     Thanks for your response.    Gave this a run but it’s not quite
>     working.
>
>     Looks like the problem stems from the colour being defined across
>     three bands, with black defined by 0,0,0
>
>
>
>     When “No data = 0” this clears all colours where band 1 = 0. 
>     Which includes a lot more colours than just black.
>
>     Tried entering a few different formats to cover the all 3 bands
>     but the second  2 are always ignored.
>
>     Any thoughts as to how I get 3 bands recognised?
>
>     Brett
>
>     *From:*Qgis-user [mailto:qgis-user-bounces at lists.osgeo.org] *On
>     Behalf Of *Richard McDonnell
>     *Sent:* Monday, 14 August 2017 10:16 PM
>     *To:* qgis-user at lists.osgeo.org <mailto:qgis-user at lists.osgeo.org>
>     *Subject:* Re: [Qgis-user] background transparency
>
>     Brett,
>     Apologies, ive just realised your version of QGIS may not have the
>     processing toolbox.
>     You may also do this by going to *RASTER*, *Conversion *and
>     selecting*Translate *Its the very same tool just a different interface
>     Regards,
>
>     Richard
>
>     On 14/08/2017 15:04, Richard McDonnell wrote:
>
>         Hi Brett
>         You can indeed, just use the Processing toolbox, just type
>         Translate into the search box and select the Translate Tool
>         under GDAL.
>         The values you specified as transparent, can be specified
>         under the Nodata Value
>         You can also do this as part of a batch if you have a number
>         of files, you wish to do this for.
>
>         Hope this helps,
>
>         Richard.
>
>         On 14/08/2017 14:07, Brett Adams wrote:
>
>             Hi Folks,
>
>             I have a geotiff that contains a black ground in areas
>             where there is no data.  The black background is made
>             transparent within QGIS via “Layer Properties – Transparency”
>
>             Can I export a new Geotiff with the black background removed?
>
>             I’m running 2.6.1 On Windows-7. Yes, I know it’s an old
>             version but I’ve had no reason to update.  So far…
>
>             Thanks
>
>             *Brett Adams*
>
>             *Spinifex-GPX*
>
>             *0438 861 974*
>
>
>
>
>
>             _______________________________________________
>
>             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
>
>             Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-user
>
>         -- 
>         *_Richard McDonnell_*
>         *GIS Specialist PgD GIS AssocSCSI*
>         *OPW FRM Data Management*
>         *52 Stephens Green, Dublin 2.*
>         TEL: 01 6476543
>
>         <http://www.opw.ie/>
>
>
>
>         Email Disclaimer: http://www.opw.ie/en/disclaimer/
>
>
>
>         _______________________________________________
>
>         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
>
>         Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-user
>
>     -- 
>     *_Richard McDonnell_*
>     *GIS Specialist PgD GIS AssocSCSI*
>     *OPW FRM Data Management*
>     *52 Stephens Green, Dublin 2.*
>     TEL: 01 6476543
>
> -- 
> *_Richard McDonnell_*
> *GIS Specialist PgD GIS AssocSCSI*
> *OPW FRM Data Management*
> *52 Stephens Green, Dublin 2.*
> TEL: 01 6476543
>

-- 
*_Richard McDonnell_*
*GIS Specialist PgD GIS AssocSCSI*
*OPW FRM Data Management*
*52 Stephens Green, Dublin 2.*
TEL: 01 6476543
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20170817/72e8f520/attachment.html>


More information about the Qgis-user mailing list