diff options
-rwxr-xr-x | mkindex.pl | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -183,9 +183,13 @@ use Geo::OSR; # http://www.imagemagick.org/script/perl-magick.php use Image::Magick; -my %config = ( progress => Geo::GDAL->can('TermProgress_nocb') ? - sub { Geo::GDAL::TermProgress_nocb(@_[0,1]) } : - *Geo::GDAL::TermProgress +my %config = ( progress => sub { + open *X, '>&', \*STDOUT or die "Can't dup STDOUT: $!"; + open STDOUT, '>&', STDERR or die "Can't dup STDERR: $!"; + Geo::GDAL::TermProgress_nocb(@_[0,1]); + open STDOUT, '>&', \*X or die "Can't dup X: $!"; + close *X; + } , debug => 0 , rename => 's/\.[^.]+$//' , outsize => [ 1024, 0 ] @@ -414,8 +418,14 @@ sub merge { (keys %$driver_opts); my @src_filenames = map {$_->{filename}} @mapset; - system 'gdalwarp', @opts, @src_filenames, $dst_filename; - $? == 0 or die "gdalwarp failed.\n"; + { + open *X, '>&', \*STDOUT or die "Can't dup STDOUT: $!"; + open STDOUT, '>&', STDERR or die "Can't dup STDERR: $!"; + system 'gdalwarp', @opts, @src_filenames, $dst_filename; + $? == 0 or die "gdalwarp failed.\n"; + open STDOUT, '>&', \*X or die "Can't dup X: $!"; + close *X; + } return $dst_filename; } @@ -477,6 +487,7 @@ sub annotate { $img->Composite( image => $text, compose => 'Over' ); undef $text; } + binmode STDOUT if $index =~ /^(?:[[:alnum:]]*:)?-$/; # Useful for pipes $img->Write($index); undef $img; } |