<div class="gmail_quote">
<div style="FONT-FAMILY: consolas">Hi experts!</div>
<div style="FONT-FAMILY: consolas"> </div>
<div style="FONT-FAMILY: consolas">I'm trying to make a (lower quality) copy of a GeoTIFF file, and add overviews to that copy.</div>
<div style="FONT-FAMILY: consolas">It seems to work fine, BUT the resulting file has the colors messed up!</div>
<div style="FONT-FAMILY: consolas">With JPEG_QUALITY=30, the colors seem to be "faded".</div>
<div style="FONT-FAMILY: consolas">With JPEG_QUALITY=90, they're more "intense" than the original.</div>
<div style="FONT-FAMILY: consolas">GDALINFO reports identical info for the input and output files (except for the overviews and quality)</div>
<div style="FONT-FAMILY: consolas"> </div>
<div style="FONT-FAMILY: consolas">The complete code (VisualBasic 2010, 32bits):</div>
<div style="FONT-FAMILY: consolas"> </div>
<div style="FONT-FAMILY: consolas"> <span style="COLOR: blue">Dim</span> gtiffdriver <span style="COLOR: blue">As</span> <span style="COLOR: #2b91af">Driver</span> = <span style="COLOR: #2b91af">Gdal</span>.GetDriverByName(<span style="COLOR: #a31515">"GTIFF"</span>)<br>
<span style="COLOR: blue">Dim</span> viewfileoptions() <span style="COLOR: blue">As</span> <span style="COLOR: blue">String</span> = {<span style="COLOR: #a31515">"TFW=YES"</span>, <span style="COLOR: #a31515">"TILED=YES"</span>, <span style="COLOR: #a31515">"BLOCKXSIZE=256"</span>, <span style="COLOR: #a31515">"BLOCKYSIZE=256"</span>,<br>
<span style="COLOR: #a31515">"COMPRESS=JPEG"</span>, <span style="COLOR: #a31515">"JPEG_QUALITY=30"</span>, <span style="COLOR: #a31515">"PHOTOMETRIC=YCBCR"</span>,<br>
<span style="COLOR: #a31515">"INTERLEAVE=PIXEL"</span>,<br> <span style="COLOR: #a31515">"PROFILE=GeoTIFF"</span>, <span style="COLOR: #a31515">"BIGTIFF=IF_SAFER"</span>}<br>
<span style="COLOR: blue">Dim</span> inputdataset <span style="COLOR: blue">As</span> <span style="COLOR: #2b91af">Dataset</span> = <span style="COLOR: #2b91af">Gdal</span>.Open(inputfile, <span style="COLOR: #2b91af">Access</span>.GA_ReadOnly)<br>
<span style="COLOR: blue">Dim</span> outputdataset <span style="COLOR: blue">As</span> <span style="COLOR: #2b91af">Dataset</span> = gtiffdriver.CreateCopy(outputfile, inputdataset, 1, viewfileoptions, <span style="COLOR: blue">Nothing</span>, <span style="COLOR: blue">Nothing</span>)<br>
outputdataset.BuildOverviews(<span style="COLOR: #a31515">"GAUSS"</span>, overviews)<br> outputdataset.FlushCache()<br> outputdataset.Dispose()<br></div>
<div style="FONT-FAMILY: consolas">1 or 0 in the strict parameter to CreateCopy makes no difference.</div>
<div style="FONT-FAMILY: consolas">I've tested both the 1.7.x version and the trunk (18dev).</div>
<div style="FONT-FAMILY: consolas"> </div>
<div style="FONT-FAMILY: consolas">-</div>
<div style="FONT-FAMILY: consolas">Helge</div></div><br>