<div dir="ltr">Thanks a lot, <div>I was able to solve the problem with gdalinfo.</div><div><br></div><div>Nicole Kamp</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Nov 25, 2021 at 2:37 PM Rahkonen Jukka (MML) <<a href="mailto:jukka.rahkonen@maanmittauslaitos.fi">jukka.rahkonen@maanmittauslaitos.fi</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="FI" style="overflow-wrap: break-word;">
<div class="gmail-m_-4196001178988263189WordSection1">
<p class="MsoNormal"><span>Hi,<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Please use “reply to all” for including the list as a recipient.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">More details would lead to less guessing. Please add gdalinfo about the source and result (georeferencing is not important), tell how did you get the image of the original (which bands
were selected, was any color enhancement applied). QGIS and a look at Layer properties – Symbology is good for that. Test with gdal_translate before going to Python and send us the command if you face the same trouble. If you cannot solve the problem yourself
send a link to test image. It does not need to be your real image, any technically similar image is good and usually even better if you cut it smaller. A 200x200 pixel sized piece of the original image without georeferencing is one alternative that probably
would not reveal secrets.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">-Jukka Rahkonen-<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0cm 0cm">
<p class="MsoNormal"><b>Lähettäjä:</b> Nicole Kamp <<a href="mailto:niki.kamp@gmail.com" target="_blank">niki.kamp@gmail.com</a>> <br>
<b>Lähetetty:</b> torstai 25. marraskuuta 2021 15.22<br>
<b>Vastaanottaja:</b> Rahkonen Jukka (MML) <<a href="mailto:jukka.rahkonen@maanmittauslaitos.fi" target="_blank">jukka.rahkonen@maanmittauslaitos.fi</a>><br>
<b>Aihe:</b> Re: [gdal-dev] GDAL COG - Problem with Overviews<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Hello!<u></u><u></u></p>
<div>
<p class="MsoNormal">Thanks. I tried it with 0,1,2 - it did not work.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Thu, Nov 25, 2021 at 1:49 PM Rahkonen Jukka (MML) <<a href="mailto:jukka.rahkonen@maanmittauslaitos.fi" target="_blank">jukka.rahkonen@maanmittauslaitos.fi</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal">Hi,<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">Maybe the band list be zero based? Try [0,1,2].</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">-Jukka Rahkonen-</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0cm 0cm">
<p class="MsoNormal"><b>Lähettäjä:</b> gdal-dev <<a href="mailto:gdal-dev-bounces@lists.osgeo.org" target="_blank">gdal-dev-bounces@lists.osgeo.org</a>>
<b>Puolesta </b>Nicole Kamp<br>
<b>Lähetetty:</b> torstai 25. marraskuuta 2021 14.44<br>
<b>Vastaanottaja:</b> <a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<b>Aihe:</b> [gdal-dev] GDAL COG - Problem with Overviews<u></u><u></u></p>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">Dear GDAL Developers, <u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">I have an overview problem with my Cloud Optimized GeoTIFF.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">I tried to translate a 16 bit, 4 bands ortho image to a COG 8bit, 3 bands image with JPEG compression.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><a href="https://pasteboard.co/CLur6VdD0CwQ.jpg" target="_blank">That is the original image.</a><br>
<a href="https://pasteboard.co/MJv3lOjlI8iM.jpg" target="_blank">That is the result.</a><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">It works fine with LZW compression, but I need the JPEG compression. What am I doing wrong?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Thanks, <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Niki<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Here is my code.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:"Times New Roman",serif"> for raster in glob.glob(str(parameters[self.INPUT_Pfad])+'/*.tif'):<br>
fileInfo = QFileInfo(raster)<br>
baseName = fileInfo.baseName()<br>
file_name = str(parameters[self.INPUT_Pfad])+'/'+baseName+'.tif'<br>
feedback.pushInfo(file_name)<br>
output_file1 = str(parameters[self.OUTPUT_Pfad])+'/'+baseName+'.tif'<br>
output_file2 = str(parameters[self.OUTPUT_Pfad])+'/'+baseName+'_cog.tif'<br>
<br>
# Create COG<br>
x_size = 6250<br>
y_size = 5000<br>
num_bands = 4<br>
<br>
src_ds = gdal.Open(file_name)<br>
format = "GTiff"<br>
driver = gdal.GetDriverByName(format)<br>
<br>
# Translate<br>
translate_options = gdal.TranslateOptions(format = 'COG', outputType = gdal.GDT_Byte, bandList = [1,2,3], scaleParams=[''],<br>
creationOptions = ['TILED=YES','COMPRESS=JPEG','BIGTIFF=IF_NEEDED', 'BLOCKXSIZE=512', 'BLOCKYSIZE=512', 'RESAMPLING=NEAREST',
'OVERVIEWS=IGNORE_EXISTING', 'INTERLEAVE=PIXEL']<br>
)<br>
gdal.Translate(output_file1, src_ds, options=translate_options)<br>
<br>
translate_options = None<br>
src_ds = None</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote></div>