Hi,

Please use “reply to all” for including the list as a recipient.
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.

-Jukka Rahkonen-

Lähettäjä: Nicole Kamp <niki.k...@gmail.com>
Lähetetty: torstai 25. marraskuuta 2021 15.22
Vastaanottaja: Rahkonen Jukka (MML) <jukka.rahko...@maanmittauslaitos.fi>
Aihe: Re: [gdal-dev] GDAL COG - Problem with Overviews

Hello!
Thanks. I tried it with 0,1,2 - it did not work.


On Thu, Nov 25, 2021 at 1:49 PM Rahkonen Jukka (MML) 
<jukka.rahko...@maanmittauslaitos.fi<mailto:jukka.rahko...@maanmittauslaitos.fi>>
 wrote:
Hi,

Maybe the band list be zero based? Try [0,1,2].

-Jukka Rahkonen-

Lähettäjä: gdal-dev 
<gdal-dev-boun...@lists.osgeo.org<mailto:gdal-dev-boun...@lists.osgeo.org>> 
Puolesta Nicole Kamp
Lähetetty: torstai 25. marraskuuta 2021 14.44
Vastaanottaja: gdal-dev@lists.osgeo.org<mailto:gdal-dev@lists.osgeo.org>
Aihe: [gdal-dev] GDAL COG - Problem with Overviews

Dear GDAL Developers,
I have an overview problem with my Cloud Optimized GeoTIFF.
I tried to translate a 16 bit, 4 bands ortho image to a COG 8bit, 3 bands image 
with JPEG compression.

That is the original image.<https://pasteboard.co/CLur6VdD0CwQ.jpg>
That is the result.<https://pasteboard.co/MJv3lOjlI8iM.jpg>

It works fine with LZW compression, but I need the JPEG compression. What am I 
doing wrong?

Thanks,
Niki


Here is my code.
        for raster in glob.glob(str(parameters[self.INPUT_Pfad])+'/*.tif'):
            fileInfo = QFileInfo(raster)
            baseName = fileInfo.baseName()
            file_name = str(parameters[self.INPUT_Pfad])+'/'+baseName+'.tif'
            feedback.pushInfo(file_name)
            output_file1 = str(parameters[self.OUTPUT_Pfad])+'/'+baseName+'.tif'
            output_file2 = 
str(parameters[self.OUTPUT_Pfad])+'/'+baseName+'_cog.tif'

            # Create COG
            x_size = 6250
            y_size = 5000
            num_bands = 4

            src_ds = gdal.Open(file_name)
            format = "GTiff"
            driver = gdal.GetDriverByName(format)

            # Translate
            translate_options = gdal.TranslateOptions(format = 'COG', 
outputType = gdal.GDT_Byte, bandList =                                          
           [1,2,3],  scaleParams=[''],
                                          creationOptions = 
['TILED=YES','COMPRESS=JPEG','BIGTIFF=IF_NEEDED',                               
                       'BLOCKXSIZE=512', 'BLOCKYSIZE=512', 
'RESAMPLING=NEAREST',                                                           
     'OVERVIEWS=IGNORE_EXISTING', 'INTERLEAVE=PIXEL']
                                          )
            gdal.Translate(output_file1, src_ds, options=translate_options)

            translate_options = None
            src_ds = None
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to