Skip to content

Instantly share code, notes, and snippets.

@frewsxcv
Created January 11, 2012 19:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frewsxcv/1596344 to your computer and use it in GitHub Desktop.
Save frewsxcv/1596344 to your computer and use it in GitHub Desktop.
Taken from ami-07db196e to assist in OpenAerialMap workflow
#!/bin/sh
export GDAL_TIFF_INTERNAL_MASK=YES
nearblack -co TILED=YES -setmask -nb 0 -of GTiff -o ./prewarp.tif $1
gdalwarp -co TILED=YES -dstalpha -t_srs EPSG:4326 prewarp.tif warped.tif
rm prewarp.tif
gdal_translate -co TILED=YES -co JPEG_QUALITY=80 -co COMPRESS=JPEG -co PHOTOMETRIC=YCBCR -b 1 -b 2 -b 3 -mask 4 warped.tif final.tif
rm warped.tif
gdaladdo final.tif 2 4 8 16 32 64 128 256
mv final.tif ${1}_converted.tif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment