Skip to content

Instantly share code, notes, and snippets.

@robindemourat
Last active September 23, 2016 06:02
Show Gist options
  • Save robindemourat/0e5b65fd613f07afb244b65060d507b9 to your computer and use it in GitHub Desktop.
Save robindemourat/0e5b65fd613f07afb244b65060d507b9 to your computer and use it in GitHub Desktop.
Deskew a folder of images w/ deskew tool
// binary deskew (depends on platform)
bin="./deskew"
if [ -f "$bin" ]
then
// necessary on linux (other platforms ?) to use it
chmod +x deskew
echo "creting output folder"
// warning - overwrites existing
mkdir -p ./output;
// listing files in input and iterating
for file in ./input/*
do
if [[ -f $file ]]; then
echo "processing $file"
filename=$(basename "$file")
// processing file with deskew
./deskew -o "./output/$filename" $file
fi
done
else
echo "$bin is not there, leaving."
fi
  • download deskew tool (http://galfar.vevb.net/wp/2014/deskew-tool-version-1-10/) and copy from the Bin folder the binary corresponding to your platform to the parent directory of your images directory
  • download/copy the bash script of this gist and put it in the parent directory of your images directory
  • rename your images directory to input (or change that in the script ! :)
  • make sure there is no output directory in your parent folder, because the script is going to overwrite it if it exists
  • if on linux change rights of the script : chmod +x deskew_folder.sh
  • run the script : ./deskew_folder.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment