<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta name=Generator content="Microsoft Word 11 (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]--><o:SmartTagType
namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="country-region"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="place"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:blue;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:Arial;
color:navy;}
@page Section1
{size:595.3pt 841.9pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=SV link=blue vlink=blue>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>Perhaps this helps. Good
luck. //Anders Söderman <st1:country-region w:st="on"><st1:place w:st="on">Sweden</st1:place></st1:country-region><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>http://www.gdal.org/frmt_gtiff.html
<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Internal nodata masks (from GDAL 1.6.0) <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>TIFF files can contain
internal transparency masks. The GeoTIFF driver recognizes an internal
directory as being a transparency mask when the FILETYPE_MASK bit value is set
on the TIFFTAG_SUBFILETYPE tag. According to the TIFF specification, such
internal transparency masks contain 1 sample of 1-bit data. Although the TIFF
specification allows for higher resolutions for the internal transparency mask,
the GeoTIFF driver only supports internal transparency masks of the same
dimensions as the main image. Transparency masks of internal overviews are also
supported<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>When the
GDAL_TIFF_INTERNAL_MASK environment variable is set to YES and the GeoTIFF file
is opened in update mode, the CreateMaskBand() method on a TIFF dataset or
rasterband will create an internal transparency mask. Otherwise, the default
behaviour of nodata mask creation will be used, that is to say the creation of
a .msk file, as per RFC 15<o:p></o:p></span></font></p>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span lang=EN-US style='font-size:12.0pt'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 face=Tahoma><span lang=EN-US
style='font-size:10.0pt;font-family:Tahoma;font-weight:bold'>From:</span></font></b><font
size=2 face=Tahoma><span lang=EN-US style='font-size:10.0pt;font-family:Tahoma'>
qgis-user-bounces@lists.osgeo.org [mailto:qgis-user-bounces@lists.osgeo.org] <b><span
style='font-weight:bold'>On Behalf Of </span></b>Pietro Panzeri<br>
<b><span style='font-weight:bold'>Sent:</span></b> den 3 juni 2010 12:57<br>
<b><span style='font-weight:bold'>To:</span></b> qgis-user@lists.osgeo.org<br>
<b><span style='font-weight:bold'>Subject:</span></b> [Qgis-user] Re: Grayscale
GeoTiff and transparency using GDAL.</span></font><span lang=EN-US><o:p></o:p></span></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>No one has a solution?<br>
Thank you.<o:p></o:p></span></font></p>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>On Mon, May 31, 2010 at 10:42 AM, Pietro Panzeri <<a
href="mailto:pietro.panzeri@treuropa.com">pietro.panzeri@treuropa.com</a>>
wrote:<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Hi all,<br>
<br>
I'm writing a plugin using GDAL C library to allow the user to create a
grayscale GeoTiff with transparency.<br>
<br>
I've used the following code to init the raster:<br>
<br>
Driver = GDALGetDriverByName("GTiff"); <br>
<br>
papszOptions = CSLSetNameValue(papszOptions, "COMPRESS",
"LZW");<br>
<br>
Dataset = GDALCreate(Driver, SrcFilename, XSize, YSize, 2, GDT_Byte,
papszOptions);<br>
<br>
Band1 = GDALGetRasterBand(Dataset, 1);<br clear=all>
GDALSetRasterColorInterpretation(Band1, GCI_GrayIndex);
<br>
<br>
Band2 = GDALGetRasterBand(Dataset, 2);<br>
GDALSetRasterColorInterpretation(Band2, GCI_AlphaBand);<br>
<br>
...<br>
Init the two bands<br>
...<br>
<br>
<br>
The result is a correct grayscale image but without transparency.<br>
<br>
Can someone point me a way to create a grayscale GeoTiff with a transparency?<br>
<br>
Thank you very much.<br>
<br>
Pietro<br>
<br clear=all>
<br>
-- <br>
Pietro Panzeri<br>
<br>
Software Development Manager<br>
<br>
Tele-Rilevamento Europa - T.R.E. srl<br>
Via Vittoria Colonna, 7<br>
20149 Milano – Italia<br>
Tel.: +39.02.4343.121 - Fax: +39.02.4343.1230<br>
<font color="#888888"><span style='color:#888888'><a
href="mailto:pietro.panzeri@treuropa.com" target="_blank">pietro.panzeri@treuropa.com</a>
- <a href="http://www.treuropa.com" target="_blank">www.treuropa.com</a></span></font><o:p></o:p></span></font></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><br>
<br clear=all>
<br>
-- <br>
Pietro Panzeri<br>
<br>
Software Development Manager<br>
<br>
Tele-Rilevamento Europa - T.R.E. srl<br>
Via Vittoria Colonna, 7<br>
20149 Milano – Italia<br>
Tel.: +39.02.4343.121 - Fax: +39.02.4343.1230<br>
<a href="mailto:pietro.panzeri@treuropa.com">pietro.panzeri@treuropa.com</a> - <a
href="http://www.treuropa.com">www.treuropa.com</a><o:p></o:p></span></font></p>
</div>
</body>
</html>