<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Verdana;
        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";}
h1
        {margin-top:12.0pt;
        margin-right:0cm;
        margin-bottom:3.0pt;
        margin-left:21.6pt;
        text-indent:-21.6pt;
        page-break-after:avoid;
        mso-list:l0 level1 lfo2;
        font-size:16.0pt;
        font-family:Arial;}
h2
        {margin-top:30.0pt;
        margin-right:0cm;
        margin-bottom:12.0pt;
        margin-left:28.8pt;
        text-align:justify;
        text-indent:-28.8pt;
        page-break-after:avoid;
        mso-list:l0 level2 lfo2;
        border:none;
        padding:0cm;
        font-size:16.0pt;
        font-family:Verdana;
        color:black;}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Verdana;
        color:windowtext;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.Section1
        {page:Section1;}
/* List Definitions */
@list l0
        {mso-list-id:1576469857;
        mso-list-template-ids:1114654862;}
@list l0:level1
        {mso-level-style-link:"Titre 1";
        mso-level-text:%1;
        mso-level-tab-stop:21.6pt;
        mso-level-number-position:left;
        margin-left:21.6pt;
        text-indent:-21.6pt;}
@list l0:level2
        {mso-level-style-link:"Titre 2";
        mso-level-text:"%1\.%2";
        mso-level-tab-stop:28.8pt;
        mso-level-number-position:left;
        margin-left:28.8pt;
        text-indent:-28.8pt;}
@list l0:level3
        {mso-level-text:"%1\.%2\.%3";
        mso-level-tab-stop:36.0pt;
        mso-level-number-position:left;
        margin-left:36.0pt;
        text-indent:-36.0pt;}
@list l0:level4
        {mso-level-text:"%1\.%2\.%3\.%4";
        mso-level-tab-stop:43.2pt;
        mso-level-number-position:left;
        margin-left:43.2pt;
        text-indent:-43.2pt;}
@list l0:level5
        {mso-level-text:"%1\.%2\.%3\.%4\.%5";
        mso-level-tab-stop:50.4pt;
        mso-level-number-position:left;
        margin-left:50.4pt;
        text-indent:-50.4pt;}
@list l0:level6
        {mso-level-text:"%1\.%2\.%3\.%4\.%5\.%6";
        mso-level-tab-stop:57.6pt;
        mso-level-number-position:left;
        margin-left:57.6pt;
        text-indent:-57.6pt;}
@list l0:level7
        {mso-level-text:"%1\.%2\.%3\.%4\.%5\.%6\.%7";
        mso-level-tab-stop:64.8pt;
        mso-level-number-position:left;
        margin-left:64.8pt;
        text-indent:-64.8pt;}
@list l0:level8
        {mso-level-text:"%1\.%2\.%3\.%4\.%5\.%6\.%7\.%8";
        mso-level-tab-stop:72.0pt;
        mso-level-number-position:left;
        margin-left:72.0pt;
        text-indent:-72.0pt;}
@list l0:level9
        {mso-level-text:"%1\.%2\.%3\.%4\.%5\.%6\.%7\.%8\.%9";
        mso-level-tab-stop:79.2pt;
        mso-level-number-position:left;
        margin-left:79.2pt;
        text-indent:-79.2pt;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
-->
</style>
</head>
<body lang=FR link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>Hi all again,<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span lang=EN-GB style='font-size:
10.0pt;font-family:Verdana'>Using the GDAL CSharp binding, I am trying to
convert RGB data from a Dataset (MEM driver) to 8 bits gray scaled JPEG.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span lang=EN-GB style='font-size:
10.0pt;font-family:Verdana'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span lang=EN-GB style='font-size:
10.0pt;font-family:Verdana'>I create a ColorTable of GPI_Gray interpretation type
and populate it with CreateColorRamp with ColorEntries from 0,0,0 to
255,255,255.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span lang=EN-GB style='font-size:
10.0pt;font-family:Verdana'>I set the color interpretation for the new (MEM
driver) dataset single band to GCI_GrayIndex.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span lang=EN-GB style='font-size:
10.0pt;font-family:Verdana'>Then use DitherRGB2PCT and finally CreateCopy with the
JPEG driver.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span lang=EN-GB style='font-size:
10.0pt;font-family:Verdana'>But the output remains empty (1 colour : 0,0,0).<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span lang=EN-GB style='font-size:
10.0pt;font-family:Verdana'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span lang=EN-GB style='font-size:
10.0pt;font-family:Verdana'>I tried to figure out how gdal_translate may do it
with the –expand gray option but it uses a VRTSourcedRasterBand which
does not seem to be available in CSharp.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span lang=EN-GB style='font-size:
10.0pt;font-family:Verdana'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span lang=EN-GB style='font-size:
10.0pt;font-family:Verdana'>Thanks,<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span lang=EN-GB style='font-size:
10.0pt;font-family:Verdana'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span lang=EN-GB style='font-size:
10.0pt;font-family:Verdana'>Marc<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span lang=EN-GB style='font-size:
10.0pt;font-family:Verdana'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span lang=EN-GB style='font-size:
10.0pt;font-family:Verdana'><o:p> </o:p></span></font></p>
</div>
</body>
</html>