Opened 6 years ago

Closed 2 years ago

#3917 closed enhancement (wontfix)

COPY_SRC_OVERVIEWS option of gdal_translate incompatible with -outsize and -srcwin

Reported by: jcrepetto Owned by: warmerdam
Priority: normal Milestone:
Component: Utilities Version: svn-trunk
Severity: normal Keywords:
Cc:

Description

I have a file containing overviews :

$ gdalinfo -noct World.ozf2 
Driver: OZI/OZI
Files: World.ozf2
Size is 2108, 2048
Coordinate System is `'
Band 1 Block=64x64 Type=Byte, ColorInterp=Palette
  Overviews: 527x512, 211x205, 105x102, 53x51
  Color Table (RGB with 256 entries)

Thanks to the -outsize option, I can create a TIFF file containing only the first overview :

$ gdal_translate -outsize 25% 25%  World.ozf2 World.tif
Input file size is 2108, 2048

$ gdalinfo -noct World.tif
Driver: GTiff/GeoTIFF
Files: World.tif
Size is 527, 512
Band 1 Block=527x15 Type=Byte, ColorInterp=Palette
  Color Table (RGB with 256 entries)

But I would like to keep the other overviews, so I add the COPY_SRC_OVERVIEW option :

$ gdal_translate -outsize 25% 25%  -co COPY_SRC_OVERVIEWS=YES World.ozf2 World.tif
Input file size is 2108, 2048

$ gdalinfo -noct World.tif
Driver: GTiff/GeoTIFF
Files: World.tif
Size is 527, 512
Band 1 Block=527x15 Type=Byte, ColorInterp=Palette
  Color Table (RGB with 256 entries)

There are no overviews in the output file. I expected three overviews (211x205, 105x102, 53x51).

Same problem with the -srcwin option :

$ gdal_translate -srcwin 0 0 527 512 -co COPY_SRC_OVERVIEWS=YES World.ozf2 World.tifInput file size is 2108, 2048

$ gdalinfo -noct World.tif
Driver: GTiff/GeoTIFF
Files: World.tif
Size is 527, 512
Band 1 Block=527x15 Type=Byte, ColorInterp=Palette
  Color Table (RGB with 256 entries)

No overviews in the output file.

Change History (2)

comment:1 Changed 6 years ago by rouault

  • Type changed from defect to enhancement

Yes as I explained in http://lists.osgeo.org/pipermail/gdal-dev/2011-January/027379.html this is the expected behaviour (from a developer point of view ;-)) due to the use of an intermediate VRT when using gdal_translate options.

The main purpose of that option was to be able to translate an uncompressed TIFF with overviews into a compressed TIFF without needing to recompute the overviews, which can be a slow (and lossy) operation when operating on compressed datasets.

I do not anticipate any progress on this unless the VRT format supports exposing source overviews, which at first thought, doesn't seen obvious at all especially in the -outsize case. A naive but very natural implementation would create 4 overviews like the source dataset, each overview being 25% the size of the source overview...

Reclassifying as enhancement.

I've added a warning about this in the GTiff driver doc in r21530

comment:2 Changed 2 years ago by jratike80

  • Resolution set to wontfix
  • Status changed from new to closed

Closing this as wontfix. The use case of this ticket is not common enough for judging a special handling when -outsize fits exactly with some overview level.

Note: See TracTickets for help on using tickets.