When creating a GeoTiff and using Deflate or LZW as compression it is possible to select the level of compression from 1 to 9. Is it possible afterwards to see which level was used?

I have a lot of data which benefits from compression (sometimes easily Gigabytes for just one file) but I'm trying to keep reading quickly as well. Therefore I would like to only use level 1 for my files.

I'm making a plugin in QGIS to quickly analyse all rasters in a project. I'm now showing if a file uses compression, but would like to extend that and show the level of compression as well.

  • 1
    Based on stackoverflow.com/questions/16153334/… I suppose it is usually not possible. – user30184 Dec 21 '17 at 22:53
  • 2
    You could get the file size on disc and calculate uncompressed file size (rows x columns x bytes_per_pixel x band_count) to show a ratio, although this ignores the overhead of a header (and possible internal pyramids) it's an approximation only. – Michael Stimson Dec 21 '17 at 23:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.