Create a gist now

Instantly share code, notes, and snippets.

@robindemourat /.bash
Last active Sep 23, 2016

What would you like to do?
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