[gdal-dev] GDAL COG - Problem with Overviews

Nicole Kamp niki.kamp at gmail.com
Thu Nov 25 04:44:17 PST 2021


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20211125/9781240c/attachment.html>


More information about the gdal-dev mailing list