From 61bb681975a271f8fa4008cf6760f321e9c2e881 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Tue, 13 Aug 2013 20:54:19 +0200 Subject: Suggest to keep the compression algorithm. --- mkindex.pl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mkindex.pl b/mkindex.pl index 50212bc..4d3afa7 100755 --- a/mkindex.pl +++ b/mkindex.pl @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -our $VERSION = "0.2, August 12, 2013"; +our $VERSION = "0.3, August 13, 2013"; use 5.010_000; use warnings; @@ -283,6 +283,9 @@ foreach my $map (@mapset) { my ($new,$path,$suffix) = fileparse ($name, qr/\.[^.]*$/); $new = File::Spec->catfile($path,$new.'_new'.$suffix); my $driver = $ds->GetDriver()->{ShortName}; + my %opts = %$gdal_opts; + my $compress = $ds->GetMetadata('IMAGE_STRUCTURE')->{COMPRESSION}; + $opts{COMPRESS} = $compress if $compress; warn "WARN: ".join (' ', map { my $x = $_; $x =~ s/"/\\"/; @@ -290,7 +293,7 @@ foreach my $map (@mapset) { $x } ( 'gdal_translate', '-of', $driver - , (map { ('-co', $_.'='.$gdal_opts->{$_}) } (keys %$gdal_opts)) + , (map { ('-co', $_.'='.$opts{$_}) } (keys %opts)) , $old, $new ) ). "\n"; -- cgit v1.2.3