<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Brett,<br>
There appears to be nothing wrong with those examples, if there
where, you would be informed anyway!<br>
Another approach try this <i><b>gdal_calc.py -A input.tif
--outfile=result.tif --calc="A*(A>0)" --NoDataValue=0<br>
</b></i>This supposes of course, you are familiar with command
line GDAL!<br>
<br>
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.<br>
Without having a subset of your dataset to play with Im sorry, I
cant be of any more help!!<br>
Regards,<br>
<br>
Richard.<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">On 16/08/2017 03:32, Brett Adams wrote:<br>
</div>
<blockquote cite="mid:1tcg6l01bn159a4r@seg1.opw.ie" type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
color:black;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman","serif";
color:black;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";
color:black;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";
color:black;
mso-fareast-language:EN-US;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;
color:black;
mso-fareast-language:EN-US;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";
color:black;
mso-fareast-language:EN-US;}
span.EmailStyle22
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.EmailStyle23
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.EmailStyle24
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.comment-copy
{mso-style-name:comment-copy;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">Hi Richard,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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. <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Maybe I’ve got the syntax slightly wrong?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>Original <o:p></o:p></b></p>
<p class="MsoNormal">gdalwarp -overwrite -s_srs EPSG:28351
""C:/Brett.tif" <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>Trialled variations<o:p></o:p></b></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">gdalwarp -overwrite -srcnodata "0,0,0"
-dstnodata "0,0,0" -s_srs EPSG:28351 -of GTiff "C:/Brett.tif"
"C:/Brett2.tif"<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">gdalwarp -overwrite -srcnodata "0,0,0"
-dstnodata "0,0,0" -of GTiff "C:/Brett.tif" "C:/Brett2.tif"<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">gdalwarp -overwrite <span
class="comment-copy"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#242729">-srcnodata
None -dstnodata None -dstalpha </span></span>-s_srs
EPSG:28351 -of GTiff "C:/Brett.tif" "C:/Brett2.tif"<o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Brett<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF
1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:EN-AU"
lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:EN-AU"
lang="EN-US"> Richard McDonnell
[<a class="moz-txt-link-freetext" href="mailto:richard.mcdonnell@opw.ie">mailto:richard.mcdonnell@opw.ie</a>] <br>
<b>Sent:</b> Tuesday, 15 August 2017 11:17 PM<br>
<b>To:</b> Brett Adams; <a class="moz-txt-link-abbreviated" href="mailto:qgis-user@lists.osgeo.org">qgis-user@lists.osgeo.org</a><br>
<b>Subject:</b> Re: [Qgis-user] background transparency<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hi,<br>
Just looking into this, but you might try whats outlined here<br>
<br>
<a moz-do-not-send="true"
href="https://gis.stackexchange.com/questions/166699/replacing-rgb-value-0-0-0-with-nodata-nodata-nodata-in-gdal">https://gis.stackexchange.com/questions/166699/replacing-rgb-value-0-0-0-with-nodata-nodata-nodata-in-gdal</a><br>
<br>
Warp, can be found under <b>Raster</b>, <b>Projections</b>,<b>
Warp </b>fill in the fields just as you done before for the
Translate, with the exception of the nodata field.<br>
<br>
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.<br>
You should paste <b><i>-srcnodata "0,0,0" -dstnodata "0,0,0"
</i></b>just after<b><i> -overwrite </i></b>so as you have
something like below<b><i>.<br>
<br>
</i></b>gdalwarp -overwrite -srcnodata "0,0,0" -dstnodata
"0,0,0" -of GTiff raster_in.tif raster_out.tif<br>
<br>
Hope this helps.<br>
<br>
Regards,<br>
<br>
Richard.<br>
<br>
<br>
<br>
<o:p></o:p></p>
<div>
<p class="MsoNormal">On 15/08/2017 13:42, Brett Adams wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:#1F497D">Richard,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Thanks for
your response. Gave this a run but it’s not quite
working.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Looks like
the problem stems from the colour being defined across
three bands, with black defined by 0,0,0</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-AU"><br>
<br>
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">When “No data
= 0” this clears all colours where band 1 = 0. Which
includes a lot more colours than just black.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Tried
entering a few different formats to cover the all 3 bands
but the second 2 are always ignored.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Any thoughts
as to how I get 3 bands recognised?</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Brett</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #B5C4DF
1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:EN-AU"
lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:EN-AU"
lang="EN-US"> Qgis-user [<a moz-do-not-send="true"
href="mailto:qgis-user-bounces@lists.osgeo.org">mailto:qgis-user-bounces@lists.osgeo.org</a>]
<b>On Behalf Of </b>Richard McDonnell<br>
<b>Sent:</b> Monday, 14 August 2017 10:16 PM<br>
<b>To:</b> <a moz-do-not-send="true"
href="mailto:qgis-user@lists.osgeo.org">qgis-user@lists.osgeo.org</a><br>
<b>Subject:</b> Re: [Qgis-user] background
transparency</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Brett, <br>
Apologies, ive just realised your version of QGIS may not
have the processing toolbox.<br>
You may also do this by going to <b>RASTER</b>, <b>Conversion
</b>and selecting<b> Translate </b>Its the very same tool
just a different interface<br>
Regards,<br>
<br>
Richard<o:p></o:p></p>
<div>
<p class="MsoNormal">On 14/08/2017 15:04, Richard McDonnell
wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal" style="margin-bottom:12.0pt">Hi Brett<br>
You can indeed, just use the Processing toolbox, just type
Translate into the search box and select the Translate
Tool under GDAL.<br>
The values you specified as transparent, can be specified
under the Nodata Value<br>
You can also do this as part of a batch if you have a
number of files, you wish to do this for.<br>
<br>
Hope this helps,<br>
<br>
Richard.<o:p></o:p></p>
<div>
<p class="MsoNormal">On 14/08/2017 14:07, Brett Adams
wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">Hi Folks,<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">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”<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Can I export a new Geotiff with the
black background removed?<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">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…<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Thanks<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"><b><span
style="color:#C00000;mso-fareast-language:EN-AU">Brett
Adams</span></b><o:p></o:p></p>
<p class="MsoNormal"><b><span
style="color:#C00000;mso-fareast-language:EN-AU">Spinifex-GPX</span></b><o:p></o:p></p>
<p class="MsoNormal"><b><span
style="color:#C00000;mso-fareast-language:EN-AU">0438
861 974</span></b><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><br>
<br>
<br>
<br>
</span><o:p></o:p></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>Qgis-user mailing list<o:p></o:p></pre>
<pre><a moz-do-not-send="true" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><o:p></o:p></pre>
<pre>List info: <a moz-do-not-send="true" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><o:p></o:p></pre>
<pre>Unsubscribe: <a moz-do-not-send="true" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><o:p></o:p></pre>
</blockquote>
<p class="MsoNormal"><span style="font-size:12.0pt"> </span><o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">-- <br>
<b><u>Richard McDonnell</u></b><br>
</span><b><span style="font-size:7.5pt">GIS Specialist
PgD GIS AssocSCSI</span></b><span
style="font-size:12.0pt"><br>
</span><b><span style="font-size:10.0pt">OPW FRM Data
Management</span></b><span style="font-size:12.0pt"><br>
</span><b><span style="font-size:10.0pt">52 Stephens
Green, Dublin 2.</span></b><span
style="font-size:12.0pt"><br>
</span><span style="font-size:7.5pt">TEL: 01 6476543</span><o:p></o:p></p>
</div>
<p><a moz-do-not-send="true" href="http://www.opw.ie/"><span
style="text-decoration:none"><img
moz-do-not-send="true" id="_x0000_i1025"
src="http://www.opw.ie/en/media/opw-logo-december-2016.gif"
border="0" height="225" width="405"></span></a><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><br>
<br>
Email Disclaimer: <a moz-do-not-send="true"
href="http://www.opw.ie/en/disclaimer/">http://www.opw.ie/en/disclaimer/</a>
<br>
<br>
<br>
<br>
</span><o:p></o:p></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>Qgis-user mailing list<o:p></o:p></pre>
<pre><a moz-do-not-send="true" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><o:p></o:p></pre>
<pre>List info: <a moz-do-not-send="true" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><o:p></o:p></pre>
<pre>Unsubscribe: <a moz-do-not-send="true" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><o:p></o:p></pre>
</blockquote>
<p class="MsoNormal"><span style="font-size:12.0pt"> </span><o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">-- <br>
<b><u>Richard McDonnell</u></b><br>
</span><b><span style="font-size:7.5pt">GIS Specialist PgD
GIS AssocSCSI</span></b><span style="font-size:12.0pt"><br>
</span><b><span style="font-size:10.0pt">OPW FRM Data
Management</span></b><span style="font-size:12.0pt"><br>
</span><b><span style="font-size:10.0pt">52 Stephens
Green, Dublin 2.</span></b><span
style="font-size:12.0pt"><br>
</span><span style="font-size:7.5pt">TEL: 01 6476543</span><o:p></o:p></p>
</div>
</blockquote>
<p class="MsoNormal"><span
style="font-size:12.0pt;font-family:"Times New
Roman","serif";mso-fareast-language:EN-AU"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><span
style="font-size:12.0pt;font-family:"Times New
Roman","serif";mso-fareast-language:EN-AU">--
<br>
<b><u>Richard McDonnell</u></b><br>
</span><b><span
style="font-size:7.5pt;font-family:"Times New
Roman","serif";mso-fareast-language:EN-AU">GIS
Specialist PgD GIS AssocSCSI</span></b><span
style="font-size:12.0pt;font-family:"Times New
Roman","serif";mso-fareast-language:EN-AU"><br>
</span><b><span
style="font-size:10.0pt;font-family:"Times New
Roman","serif";mso-fareast-language:EN-AU">OPW
FRM Data Management</span></b><span
style="font-size:12.0pt;font-family:"Times New
Roman","serif";mso-fareast-language:EN-AU"><br>
</span><b><span
style="font-size:10.0pt;font-family:"Times New
Roman","serif";mso-fareast-language:EN-AU">52
Stephens Green, Dublin 2.</span></b><span
style="font-size:12.0pt;font-family:"Times New
Roman","serif";mso-fareast-language:EN-AU"><br>
</span><span style="font-size:7.5pt;font-family:"Times
New
Roman","serif";mso-fareast-language:EN-AU">TEL:
01 6476543</span><span
style="font-size:12.0pt;font-family:"Times New
Roman","serif";mso-fareast-language:EN-AU"><o:p></o:p></span></p>
</div>
</div>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<b><u>Richard McDonnell</u></b><br>
<b><small><small><small>GIS Specialist PgD GIS AssocSCSI</small></small></small></b><br>
<b><small>OPW FRM Data Management</small></b><br>
<b><small>52 Stephens Green, Dublin 2.</small></b><br>
<small><small>TEL: 01 6476543</small></small></div>
</body>
</html>