Skip to content

Instantly share code, notes, and snippets.

@timwaters
Created March 24, 2015 16:02
Show Gist options
  • Save timwaters/3e90ab6beb65c3020f65 to your computer and use it in GitHub Desktop.
Save timwaters/3e90ab6beb65c3020f65 to your computer and use it in GitHub Desktop.
batch compressing and adding gdaloveviews to a directory of files
i=0
for file in *.tif; do
echo $((i++))
tmp_tiff=$(basename $file .tif)_deflate.tif
echo Compressing $file to $tmp_tiff
gdal_translate -co COMPRESS=deflate $file $tmp_tiff
echo Adding overviews to $tmp_tiff
gdaladdo -r average $tmp_tiff 2 4 8 16 32 64
echo rm and move to orig
mv $tmp_tiff $file
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment