Skip to content

Instantly share code, notes, and snippets.

@IReese
Last active October 30, 2019 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IReese/220313568c7c34401867f5362f56d4b8 to your computer and use it in GitHub Desktop.
Save IReese/220313568c7c34401867f5362f56d4b8 to your computer and use it in GitHub Desktop.
#!/bin/bash
FILE_IN=$1
TILE_NUM=$2
file_name=$( basename $FILE_IN | sed 's/.tif//' )
function tiff_dims() {
EXTENT=$(tiffinfo "$1" | grep 'Image Width:' | sed 's/Image Width://' | sed 's/Image Length://' )
echo -n "$EXTENT"
}
ExtractedExtent=$(tiff_dims "${FILE_IN}")
#echo $ExtractedExtent
set -- $ExtractedExtent
pix_wide=$1
pix_high=$2
width_extract=$( bc <<< ''$pix_wide'/'$TILE_NUM'' )
height_extract=$( bc <<< ''$pix_high'/'$TILE_NUM'' )
echo "$pix_wide"
echo "$pix_high"
echo "$width_extract"
echo "$height_extract"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment